[Perl-unix-users] Re:sortByWeek

2002-07-01 Thread taguti
> You could try something like this: > my @res = &sortByWeek ('FRI0101', 'TUE0202', 'MON2359'); > print "@res\n"; > sub sortByWeek { > my %WeekNum = ('MON'=>0, 'TUE'=>1, 'WED'=>2, 'THU'=>3, 'FRI'=>4, > 'SAT'=>5, 'SUN'=>6); > return map $_->[0], sort { $a->[1] cmp $b->[1] } >map [

Re: [Perl-unix-users] sortByWeek

2002-07-01 Thread $Bill Luebkert
taguti wrote: > Hello, > > I'm wondering more good or Perlish code. > > Strings are in formed "wwwHHMM", from "MON" to "SUN2359". > So all data in good order is: > @week = qw(MON TUE WED THU FRI SAT SUN); > for my $w (@week) { > for my $HH ('00' .. '23') { > for my $MM ('00' .. '59') {

[Perl-unix-users] sortByWeek

2002-07-01 Thread taguti
Hello, I'm wondering more good or Perlish code. Strings are in formed "wwwHHMM", from "MON" to "SUN2359". So all data in good order is: @week = qw(MON TUE WED THU FRI SAT SUN); for my $w (@week) { for my $HH ('00' .. '23') { for my $MM ('00' .. '59') { push @all, $w . $HH . $MM;