Hi,
One solution could be:
my @sorted_lines = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [(substr $_,2,8) => $_] } <DATA>; __DATA__ 1&20070102&string3&string4.... 2&20070101&string3&string4.... 3&20061212&&string3&string4....
If your files are really big, then you could try another approach...
Regards,
In reply to Re: How to sort data in the input file ?
by fmerges
in thread How to sort data in the input file ?
by bh_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |