Can someone explain why @_ is modified? I thought my ($str) = @_ made a copy of the elements of @_./usr/bin/perl -we ' use strict; sub fn { my ($str) = @_; print "<@_>\n"; $str =~ s/x//; print "<@_>\n"; } $_ = "x"; s/(x)/fn $1/e; ' <x> Use of uninitialized value $_[0] in join or string at -e line 5. <>
In reply to Strange modification of @_ by jrw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |