in reply to Re: Modify hash reference itself
in thread Modify hash reference itself
Actually, to be completely pendantic, $a and $b are perfectly safe so long as you use an inline sort routine in the same scope. For example, this won't work:
But, the following will work:xyz(1 .. 5); sub xyz { my $a = shift; sort { $a <=> $b } @_; print "$a\n"; }
Since abc() provides a different lexical scope than xyz(), everything is ok and $a within xyz() is safe.xyz(1 .. 5); sub xyz { my $a = shift; abc(@_); print "$a\n"; } sub abc { sort { $a <=> $b } @_; }
But, your point of confusion is still good, as single-letter variables are poor.
------
We are the carpenters and bricklayers of the Information Age.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Modify hash reference itself
by Anonymous Monk on Dec 02, 2003 at 00:59 UTC |