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 field size
I am trying
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