|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re^4: = rather than =~ ? (too brief?)by Coruscate (Sexton) |
| on Jan 02, 2004 at 05:43 UTC ( #318248=note: print w/ replies, xml ) | Need Help?? |
|
$foo = $1 if /(foo)/; may very well be the expected behaviour in certain situations where we want to modify $foo if the match is successfull or leave it otherwise. Using it when declaring a variable is not desirable however. If there is no match, then $foo will not be Basically, $foo = $1 if /(foo)/; should really only be used where we might otherwise do a $foo = /(foo)/ ? $1 : $foo; (which is just programatically ugly). Update: Whoa, was I off base. Read the replies to this node to see the reason :)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||