in reply to Using the result of s///
print $string =~ s/_/ /g;
That line actually parses to something like:
$matches = $string =~ s/_/ /g; print $matches;
That's because print is receiving the result returned by the substitution, not the string that is being substituted. And the result returned in a substitution is the number of successful substtutions.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|