(Shamelessly cut&pasted from my own code, stolen from somewhere else, but I've forgotten where.. )my @list = sort keys %Commands; $colwidth = length((sort {length($b) <=> length($a)} @list)[0] + ) +1; $ncol = int( $Users{$userid}{'screenwidth'}/$colwidth ); $nrow = int( scalar(@list) / $ncol ); $nrow++ if ( scalar(@list) % $ncol ); $fmt = "%-${colwidth}s"; foreach my $r ( 0 .. $nrow-1 ) { my $ind = @help; $help[$ind] = ''; foreach my $c ( 0 .. $ncol-1 ) { my $i = $c * $nrow + $r; $help[$ind] .= sprintf( $fmt, $list[$i] ) if($list[$i] +); } }
C.
In reply to Re: 'ls -C' column style
by castaway
in thread 'ls -C' column style
by hv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |