From: Ian Jackson Date: Tue, 25 Jan 2011 15:20:32 +0000 (+0000) Subject: canon: key %s on stall,commod separately X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=ff7f8750ac8f8b60f034fc429173923f8cb23949;p=ypp-sc-tools.git canon: key %s on stall,commod separately --- diff --git a/yarrg/canon b/yarrg/canon index 590ffa8..bb4d0ca 100755 --- a/yarrg/canon +++ b/yarrg/canon @@ -11,9 +11,8 @@ foreach my $ab (qw(0 1)) { if ($bs) { @l= ($l[0],$l[1],$l[4],$l[5]); } next unless length $l[2]; $l[3]='1001' if $l[3] eq '>1000'; - my $k= sprintf "%-31s\t%-23s", $l[1], $l[0]; - $s{$k}[$ab*2]= $l[2]; - $s{$k}[$ab*2+1]= $l[3]; + $s{$l[1]}{$l[0]}[$ab*2]= $l[2]; + $s{$l[1]}{$l[0]}[$ab*2+1]= $l[3]; } close F or die $!; } @@ -47,10 +46,11 @@ sub findcommod ($) { my $laststall=''; -foreach my $k (sort keys %s) { - my @r= @{ $s{$k} }; - $k =~ m/\t/; - my ($stall,$commod) = ($`,$'); +foreach my $stall (sort keys %s) { +my $stallstuff= $s{$stall}; +foreach my $commod (sort { findcommod($a) <=> findcommod($b) } + keys %$stallstuff) { + my @r= @{ $s{$stall}{$commod} }; my $eol= ''; my $prep= sub { @@ -82,4 +82,4 @@ foreach my $k (sort keys %s) { printf "-%s",alencodenum(-$qtydiff); } print $eol; -} +}}