my @keys = reverse sort {$hash{$a} <=> $hash{$b} || $a cmp $b} (keys % +hash); foreach my $i ( 0 .. int($#keys/2) ){ # printf "%s %s\n", @keys[$i, $i+int($#keys/2)+1]; # UPDATE: expanded to avoid 'uninitialized value' warning print $keys[$i]; my $j = $i+int($#keys/2)+1; print "\t" . $keys[$j] if $j <= $#keys; print "\n"; }
In reply to Re: split hash into two columns
by davidrw
in thread split hash into two columns
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |