develooper Front page | perl.beginners | Postings from October 2009


Thread Next
Aimee Cardenas
October 27, 2009 14:53
Message ID:
Hi, All!

I need to fix the width of some strings padding with leading spaces if  
necessary.  I wanted to use printf but I don't know if you can put a  
variable in the format part the the printf statement.  For example, if  
I wanted to use the following format type:

printf OFILE "%7s\n", $str;

but instead of '7' have a variable such as $w there, how might I do  
this?  Or is there a better function for what I'm trying to do?


Aimee Cardenas

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About