Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: sorting based on a list

by SilverB1rd (Scribe)
on May 09, 2001 at 18:20 UTC ( #79094=note: print w/replies, xml ) Need Help??


in reply to sorting based on a list

I would suggest using a hash for that. You can then sort the hash or pull the words out by letter.
my %foo = { 'a' => 'alpha', 'b' => 'bravo', 'c' => 'charlie'}; foreach $x (sort(keys(%foo))) { print $foo{$x}\n; } print $foo{'b'},$foo{'a'},$foo{'c'};


------
The Price of Freedom is Eternal Vigilance

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79094]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2018-09-19 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (170 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!