XP is just a number | |
PerlMonks |
Re: sorting entires by dateby Aristotle (Chancellor) |
on Jan 01, 2004 at 23:04 UTC ( [id://318181]=note: print w/replies, xml ) | Need Help?? |
Basically you want a Schwartzian Transform. You parse the lines into a list of lists, sort it by the desired field, then extract the original data.
Of course if you want to keep them around in the parsed form for later steps, you can leave out the copy of the line and the extraction step:
I am too lazy to explain the Schwartzian transform all over again :), so I Super Searched for some explaination. Surprisingly I came up empty for the time being.. The probably most important to understand parts are references and how to use them to create complex data structures in Perl. If you understand that, the Transform itself should be almost self-explanatory. Check out perldoc perlreftut, perldoc perldsc, and perldoc perllol. Makeshifts last the longest.
In Section
Seekers of Perl Wisdom
|
|