Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Why does this print the number of matches:
$string = 'This_has_underscores';
print $string =~ s/_/ /g;
While this returns my new string: (Desired result)
$string = 'This_has_underscores';
$string =~ s/_/ /g;
print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using the result of s///
by hardburn (Abbot) on Apr 30, 2003 at 20:11 UTC | |
|
Re: Using the result of s///
by elusion (Curate) on Apr 30, 2003 at 20:15 UTC | |
|
Re: Using the result of s///
by Jenda (Abbot) on Apr 30, 2003 at 20:19 UTC | |
|
Re: Using the result of s///
by Cody Pendant (Prior) on Apr 30, 2003 at 21:01 UTC | |
|
Re: Using the result of s///
by Zaxo (Archbishop) on Apr 30, 2003 at 20:21 UTC | |
|
Re: Using the result of s///
by artist (Parson) on Apr 30, 2003 at 20:16 UTC |