> 
> --- Dan Muey <[EMAIL PROTECTED]> wrote:
> > IS there a better way to perhaps assign the value of $1 
> back to $var 
> > all in one statement? EG
> > 
> > $var = 'hello.domain.com';
> > # Instead of this ::
> > $var =~ m/((\w+)\.(\w+)$)/; # $1 then becomes 'domain.com' 
> $var = $1; 
> > # then $var becomes 'domain.com' # Perhaps a one liner version?
> > I know there's a way but it's Monday :(
> 
> lol....
> 
> The match operator returns a list of matches if your use it 
> in a list context. Instead of
> 
>   $str =~ /($pat)/;
>   $var = $1;
> 
> do
> 
>   ($var) = $str =~ /($pat)/;
> 
> Sometimes it's the difference between 
> 
>   my $var = ....
> 
> and 
> 
>   my($var) = ....
> 
> that makes all the difference. The parens put it in list context.
> *Learn* about context -- it will be your friend, but is 

Right! Duh

Like any other array assiingment my($name, $email, $food) = get_my_stuff();
Thanks for that enlightentment!

Yes I will learn, I appriciate it.

Thanks

Dan

> fickle if you don't understand it!
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day 
http://shopping.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to