Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: dictionary sorting

by Trimbach (Curate)
on Mar 13, 2002 at 13:48 UTC ( #151372=note: print w/replies, xml ) Need Help??


in reply to dictionary sorting

It IS pretty simple: the "cmp" operator that you've already quoted. Your example is complicated because you spend 2 lines eliminating non-word characters and underscores, but without that it can reduced to:
@temp = sort {lc($a) cmp lc($b)} @temp;
How simple is that? :-D

Gary Blackburn
Trained Killer

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2021-10-16 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (70 votes). Check out past polls.

    Notices?