From: "Joseph L. Casale" <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to