in reply to Map not giving me what I thought it would.
In the case of your s/^-// the return value
will always be 0 or 1.
But
in the case of:
s/something/something else/g it
could easily be a higher number.
Update: Note that wog is correct in saying that a successful match will return a TRUE value. But it can be something other than 1 if /g is specified.my $string = 'abacadaeaf'; my $result = $string =~ s/a/x/g; print $result; # prints 5
|
|---|