in reply to Copying an array or hash

This crops up often enough. Like mentioned, you shouldn't operate on $_ because it is an alias to the elements of the original data structure, and as such modifies them. Here is what cou can do:
my $original = [qw(alpha beta gamma)]; my @duplicate; for (0..$#$original) { my $temp = $original->[$_]; $temp = rand(); push @duplicate, $temp; } print "Original: $_\n" for (@$original); print "Mofified: $_\n" for (@duplicate);
Which gives the expected, and desired:
Original: alpha Original: beta Original: gamma Mofified: 0.421875 Mofified: 0.108734130859375 Mofified: 0.69537353515625
Update: Just to make things a bit more clear. I can obviously see that the original question is conserned with subroutine arguments being references. I merely expanded on the code that was attached as to not complicate the situation. Bull-blown examples with subroutines had already been posted prior to my reply. So fast to --?

Update: you might be also interested in this node, global $_ behavior which discusses up to some extent aliasing.