in reply to Re^2: referances of hashes, and subroutines
in thread referances of hashes, and subroutines
declaring the subroutine as sub change(\%){ will send the values as a referenceuse strict; use warnings; my %list=("bob" =>123, "tom" => "CAT"); sub change(\%){ my $temp = shift; foreach (keys %$temp){ print $_. " = $$temp{$_}\n"; $$temp{$_} .= "hello"; } } change (%list); foreach (keys %list){ print "$_ = $list{$_}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: referances of hashes, and subroutines
by GrandFather (Saint) on Apr 22, 2006 at 20:35 UTC | |
by ff (Hermit) on Apr 23, 2006 at 01:05 UTC | |
|
Re^4: referances of hashes, and subroutines
by tempest (Sexton) on Apr 22, 2006 at 20:30 UTC |