jettero has asked for the wisdom of the Perl Monks concerning the following question:
This seems like such a no brainer ... but I can't wrap my mind around it.
# say I've got a two dimensional array... @a = ( ["oops", 0], [ "happy", 2 ], [ "word", 4 ] ); # and I wanna print the contents of it thusly: foreach $ar (@a) { print "$ar->[0] is $ar->[1]\n" } # how would I sort the @a based on the $ar->[0]?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort my arrayref
by Trimbach (Curate) on Dec 12, 2000 at 18:33 UTC | |
|
More sort Info
by c-era (Curate) on Dec 12, 2000 at 19:39 UTC | |
|
Re: sort my arrayref
by mrmick (Curate) on Dec 12, 2000 at 18:43 UTC | |
|
Why not use a hash?
by tedv (Pilgrim) on Dec 12, 2000 at 21:56 UTC |