It just occured to me that I do not know how to sort weekdays in week-order except with this:
my @weekdays = qw/Monday Saturday Thursday/; my %order = ( monday => 1, tuesday => 2, wednesday => 3, thursday => 4, friday => 5, saturday => 6, sunday => 7, ); print join ",", map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, $order{lc $_}] } @weekdays;
is there a way without using that %order?
bw, bliako
Back to
Cool Uses for Perl