in reply to Generating images from a text file
my ( $m, %h ) = 0; while (<DATA>) { my ( $k, $v ) = split / /, $_, 2; $m = length $k if $m < length $k; $h{$k} = $v; } for ( sort keys %h ) { printf "%${m}s %s\n", $_, 'x' x $h{$_}; } __DATA__ thisone 3 thatone 1 something 7 else 4 __OUTPUT__ else xxxx something xxxxxxx thatone x thisone xxx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Generating images from a text file
by Anonymous Monk on Feb 16, 2005 at 11:33 UTC |