in reply to Re^2: Global variable unexpectedly modified when passed by reference
in thread Global variable unexpectedly modified when passed by reference

I don't understand why you can't pass by value, but no matter, you can just dereference inside the sub.

sub mysub{ my $h = shift; my %dereferenced_hash = %$h; delete $dereferenced_hash{'b'}; }
  • Comment on Re^3: Global variable unexpectedly modified when passed by reference
  • Download Code