Re: assign regex match to var all in one line

2003-02-17 Thread John W. Krahn
"R. Joseph Newton" wrote: > > Dan Muey 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

Re: assign regex match to var all in one line

2003-02-17 Thread R. Joseph Newton
Dan Muey 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 lin

RE: assign regex match to var all in one line

2003-02-17 Thread Dan Muey
Thanks! > > Dan Muey wrote: > > > > IS there a better way to perhaps assign the value of $1 > back to $var > > all in one statement? > > Yes. > > > EG > > > > $var = 'hello.domain.com'; > > # Instead of this :: > > $var =~ m/((\w+)\.(\w+)$)/; # $1 then becomes 'domain.com' > $var = $1; >

Re: assign regex match to var all in one line

2003-02-17 Thread John W. Krahn
Dan Muey wrote: > > IS there a better way to perhaps assign the value of $1 back to $var all in one >statement? Yes. > 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

RE: assign regex match to var all in one line

2003-02-17 Thread Dan Muey
> > --- 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; > > #

Re: assign regex match to var all in one line

2003-02-17 Thread Paul
--- 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.c

assign regex match to var all in one line

2003-02-17 Thread Dan Muey
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