in reply to Quick Sort Question
Something like this should work (not tested!):
use strict; use warnings; open my $fh, "<", "employees" or die "Cannot Open: $!"; my @employees; while (<$fh>) { chomp; if (/(.*):(1.*):(.*):(.*):(.*)/) { push @employees, [ $1, $2, $3, $4, $5 ]; } } close $fh; @employees = sort { $a->[2] cmp $b->[2] } @employees; for (@employees) { print join( "\t", @$_[ 2, 3, 0, 4 ] ), "\n"; }
Update: bug fixed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quick Sort Question
by thricewise (Initiate) on Dec 09, 2009 at 20:48 UTC | |
by almut (Canon) on Dec 09, 2009 at 21:01 UTC | |
by thricewise (Initiate) on Dec 09, 2009 at 21:06 UTC | |
by zwon (Abbot) on Dec 09, 2009 at 21:03 UTC |