puterboy has asked for the wisdom of the Perl Monks concerning the following question:
The result is:my $bar = "abc"; foo($bar); $bar =~ /(.*)/; my $val = $1; foo($val); foo($1); print "|$1|$bar|\n"; sub foo { print "$_[0]\n"; $_[0] =~ /(.)/; print "$_[0]\n\n"; }
abc abc abc abc abc a |abc|abc|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Side effect of passing matched values by reference
by choroba (Cardinal) on Feb 21, 2013 at 17:22 UTC | |
by puterboy (Scribe) on Feb 21, 2013 at 18:23 UTC | |
|
Re: Side effect of passing matched values by reference
by LanX (Saint) on Feb 21, 2013 at 17:47 UTC |