try ...
if ( ! $size ) { $size = 8 }
printf " %${size}s ", $yourVariableHere;
?frank
-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 4:21 PM
To: '[EMAIL PROTECTED]'
Subject: printf using a variable for the fiel
On Jan 30, Nikola Janceski said:
>printf " %8s ", $_; ## works because I put the 8 in the code
>
>but what if the variable $size has the size, how then do I use printf using
>$size in place of the 8?
Two ways come to mind:
printf " %${size}s ", $_;
and
printf " %*s ", $size, $_;
--
Jeff
I am trying to make a 'pretty' text table printout.
I have variable that holds the size of the width of the column, so how do I
make it print the string the way I want it.
printf " %8s ", $_; ## works because I put the 8 in the code
but what if the variable $size has the size, how then do I use