If you pass an array or a hash, then modifying it should not modify the original.
use YAML qw( Dump ); sub yarly { $_[0] = "O RLY?" } my @a = ( "b", "c", "d" ); print Dump( \@a ), "\n"; yarly( @a ); print Dump( \@a ), "\n"; __END__ --- #YAML:1.0 - b - c - d --- #YAML:1.0 - O RLY? - c - d
Elements of @_ are aliases for the originals.
In reply to Re^2: Copying an array or hash
by Fletch
in thread Copying an array or hash
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |