[EMAIL PROTECTED] wrote:
I am trying to sort a data file on field 3 that looks like:
08/09/04 11:02:43 E00004
08/09/04 11:02:43 E01220
...
<snip>
My question is how do I combine the two print FOO statements so
that I am still splitting fields 0,1,5 while sorting on field 5, or
the Estrings?
I have to say that I found your post confusing. Anyway, to sort a
file, you'd better start with storing the records in an array:
my @records = <D>;
Then you can sort it by anything:
perldoc -q "sort an array"
If it's the field with "E00004" etc. you want to sort by, you should
do a lexical sort (using cmp), not a numerical sort (using <=>).
Finally you can print whichever fields you like.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>