The value of s/// is a boolean indicating whether a replacement was made.
Err, no, not really. It's actually the number of replacements made. Thus:
# given $x = 'abacad'; # then $x =~ s/a/z/; # returns 1 $x =~ s/a/z/g; # returns 3 $x =~ s/x/z/; # returns empty string, not undef
... although it can be treated quite nicely in a boolean manner :)
• another intruder with the mooring in the heart of the Perl
In reply to Re^2: Using regex in Map function
by grinder
in thread Using regex in Map function
by narashima
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |