in reply to deferencing an hash in a subroutine
sub test { for (my $i = 0; $i < @_; $i += 2) { if ($_[$i] eq 'a') { $_[$i+1] = 'found a'; } } } my $a = 'not found'; test b => 3, a => $a; print "$a\n";
But beware, chaning your caller's arguments is evil, and usually produces code that's hard to understand and read.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: deferencing an hash in a subroutine
by saintex (Scribe) on Aug 20, 2010 at 15:13 UTC | |
by moritz (Cardinal) on Aug 20, 2010 at 15:19 UTC | |
by saintex (Scribe) on Aug 20, 2010 at 16:28 UTC |