Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Preserve trailing spaces with write format?

by stephen (Priest)
on Apr 17, 2002 at 18:42 UTC ( #159934=note: print w/replies, xml ) Need Help??


in reply to Preserve trailing spaces with write format?

Instead of using formats, it may be easier to use sprintf.
# Print "Hi." left-justified padded out to 20 spaces. print sprintf('%-20s', "Hi.");

stephen

Replies are listed 'Best First'.
Re: Re: Preserve trailing spaces with write format?
by tachyon (Chancellor) on Apr 17, 2002 at 20:46 UTC

    Or perhaps simply:

    printf '%-20s', "Hi.";

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2016-10-01 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (9 votes). Check out past polls.