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 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 printf using
$size in place of the 8?


Nikola Janceski
Summit Systems, Inc.
212-896-3400

Make everything as simple as possible, but not simpler.  
-- Albert Einstein (1879-1955) 


----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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


_____________________________________________________________________ 
IMPORTANT NOTICES: 
          This message is intended only for the addressee. Please notify the
sender by e-mail if you are not the intended recipient. If you are not the
intended recipient, you may not copy, disclose, or distribute this message
or its contents to any other person and any such actions may be unlawful.

         Banc of America Securities LLC("BAS") does not accept time
sensitive, action-oriented messages or transaction orders, including orders
to purchase or sell securities, via e-mail.

         BAS reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the BAS e-mail system.
                                                                                
____________________________________________________________________

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

Reply via email to