Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Sorting a text file

by jonadab (Parson)
on Mar 15, 2007 at 10:48 UTC ( [id://604959]=note: print w/replies, xml ) Need Help??


in reply to Sorting a text file

If you want to play amusing games with this problem, you could implement a crude Radix Sort:

require v5.8.0; open INPUT, '<', '/path/to/the/file/where/the/data/are.stored'; my @line = <INPUT>; close INPUT; for (reverse 8..13) { @line = sort {substr($a,$_,1) <=> substr($b,$_,1)} @line; } print @line;
-- 
We're working on a six-year set of freely redistributable Vacation Bible School materials.
Server Error (Error ID 6283682a1932198)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-03-29 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found