marksman has asked for the wisdom of the Perl Monks concerning the following question:
my %h = (a,b,c,d); &func(\%h); while ((my $key, my $val) = each %h) { print "key is $key val is $val\n"; } sub func { $_->{'e'} = 'f'; }
but I also want it to print outkey is c val is d key is a val is b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: directly modify hash from subroutine
by stevieb (Canon) on Sep 04, 2009 at 23:47 UTC | |
|
Re: directly modify hash from subroutine
by marksman (Novice) on Sep 05, 2009 at 00:04 UTC | |
by chromatic (Archbishop) on Sep 05, 2009 at 00:26 UTC | |
by biohisham (Priest) on Sep 05, 2009 at 19:56 UTC |