in reply to Using the result of s///
Because that is how it was designed :-) And rightly so (I say this even though I've just been bitten by this in @array = map {s/regexp/replace/} split(/,/, $text)) If the s/// returned the resulting string how would you know whether the regexp matched and whether anything was replaced?
if ($text =~ s/foo/bar/) { ... } else { ... }
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature
|
|---|