From: "Joseph L. Casale" <jcas...@activenetwerx.com>
What is the correct way to quickly assign the result of a regex against
a cmdline arg into a new variable:

my $var = ($ARGV[0] =~ s/(.*)foo/$1/i);

Obviously that's incorrect but is there a quick way without intermediate
assignment?

Thanks!
jlc



Yes, you can use:

( my $var = $ARGV[0] ) =~ s/(.*)foo/$1/i;

Octavian


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to