http://www.perlmonks.org?node_id=159934


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