deprecated has asked for the wisdom of the Perl Monks concerning the following question:
if we look at perldoc -f scalar we seesub shift_sort { my %hash = (1 => { foo => bar }, 2 => { baz => bletch }); shift @{ sort( { $a <=> $b } keys (%hash)) }; # doesnt work my @foo = sort( { $a <=> $b } keys (%hash)); shift @foo; # works }
indebted,
brother dep.
--
Laziness, Impatience, Hubris, and Generosity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(ar0n) Re: Using shift() on sort() and syntactical funniness
by ar0n (Priest) on Apr 15, 2001 at 07:44 UTC | |
by merlyn (Sage) on Apr 15, 2001 at 08:27 UTC | |
by Dominus (Parson) on Apr 15, 2001 at 19:49 UTC | |
by tilly (Archbishop) on Apr 16, 2001 at 06:11 UTC | |
by Fastolfe (Vicar) on Apr 16, 2001 at 20:43 UTC | |
|
Re: Using shift() on sort() and syntactical funniness
by Dominus (Parson) on Apr 15, 2001 at 19:43 UTC |