Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Generating standard length strings

by Roy Johnson (Monsignor)
on Apr 14, 2005 at 18:59 UTC ( [id://447911]=note: print w/replies, xml ) Need Help??


in reply to Generating standard length strings

sprintf "%-${length}s", $string" Update: note that length here is the name of a variable, not the function call being interpreted as a reference.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Generating standard length strings
by ihb (Deacon) on Apr 15, 2005 at 02:37 UTC

    sprintf '%-*s', $length, $string

    Less noise in the format.

    ihb

    See perltoc if you don't know which perldoc to read!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://447911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found