Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re2: Sorting @lines

by blakem (Monsignor)
on Oct 11, 2002 at 02:54 UTC ( #204393=note: print w/replies, xml ) Need Help??


in reply to Re: Sorting @lines
in thread Sorting @lines

That will break if any of the elements have spaces in them. Probably not very likely, but a safer way to write a GRT is:
my @sorted = map{(split(/\0/))[1]} sort map{sprintf"%09d%09d%s%s\0%s",(split/\./)[0..3],$_} @lines;

-Blake

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2019-08-26 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?