in reply to Re: Copying an array or hash
in thread Copying an array or hash

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.