in reply to Re: Formatting Question
in thread Formatting Question

It was format. Thanks. I guess another quick question would be is there a way to abbreviate the number of <<'s or >>'s. Like I have filled that is just 100 characters of filler (whitspace) it seems silly to have to put 100 >'s.

As I am writing this I am thinking maybe printf would be better. But can you left and right justify in printf. I am not sure.

Replies are listed 'Best First'.
Re^3: Formatting Question
by Roy Johnson (Monsignor) on May 27, 2004 at 13:55 UTC
    $_ = 'justify my love'; printf "[%20s] and [%-20s]\n", $_, $_;
    will give you
    [ justify my love] and [justify my love ]
    You can actually combine sprintf and formats, if you want to avoid specifying the width as a picture. You can use @* as your format for a line, and do all the actual formatting of the line with a sprintf. That assumes that you have some reason for using format/write instead of doing it all with printf.

    The PerlMonk tr/// Advocate
      Thanks. printf is just what I need. I appreciate all the help.