As far as the last question - how to make it efficient. You are going to need to give some idea what you mean by "large" and what resource you are looking for to be efficient with.#!/usr/bin/perl #!/usr/bin/perl use strict; use warnings; my %dow = ( Sunday => 1, Monday => 2, Tuesday => 3, Wednesday => 4, Thurday => 5, Friday => 6, Saturday => 7 ); my @data = map { chomp; $_ } <DATA>; print "$_\n" for map { $_->[0] } sort { $a->[1] <=> $b->[1] || $a->[2] <=> $b->[2] || $a->[3] cmp $ +a->[3] } map { my @field = split /,/; $field[8] =~ s/\D//g; [ $_, $dow{$field[7]}, $field[8], $field[0] ] } @data; __DATA__ "aix-dev,active,aixr03,aixr03,crmd,FULL,12345,Sunday,018:00:00" "w2k-prod,active,w2k-PROD,pub1hi,prod-web-srv1Y,FULL,3,Friday,021:00:0 +0" "w2k-prod,active,w2k-PROD,pol02pi,prod-web-srv1,CINC,,Monday,009:00:00 +" "w2k-prod,active,w2k-PROD,pub01pi,prod-web-srv1,CINC,,Monday,023:00:00 +0" "aix-dev-ecmd2,active,aixr03,aixr03,ecmD2,FULL,12345,Monday,001:00:00" "aix-prod-artp,active,aixr04,aixr04,artp-rman,FULL,2345,Sunday,021:30: +00" "w2k-prod,active,w2k-PROD,pol02pi,prod-web-srv1Y,FULL,3,Friday,023:00: +00" "w2k-prod,active,w2k-PROD,pub01pi,prod-web-srv1Y,FULL,3,Friday,021:00: +00"
Cheers - L~R
In reply to Re: Sort questions
by Limbic~Region
in thread Sort questions
by wube
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |