Lightning flashed, thunder crashed and Liger-dc <[EMAIL PROTECTED]> whispered:
| I have a formatting question:
| I have 2 arrays with integers that I want to print, with one array above the 
> other so that the
| matching entries end up in the same column. Currently they look like..
| 
| 116 44 45 49 71
|  1 1 3 5 1
| 
| and I want them to look like
| 
| 116 44 45 49 71
|   1  1  3  5  1
| 
| The problem with using write & format STDOUT is that the number of elements i
> n each array chanes
| every time the program is run.

How about using printf and building the format dynamically:

@a = qw/116 44 45 49 71/;
@b = qw/1 1 3 5 1/;
printf "%3d" x @a, @a;
print "\n";
printf "%3d" x @b, @b;
print "\n";

-spp
--
Stephen P Potter                                         [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."        -Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training  http://www.unixlabs.net/~spp/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to