emilford has asked for the wisdom of the Perl Monks concerning the following question:

Okay, so I've finally gotten the format to work, but I need a little help getting the desired layout I want. Here is my current format:
format OUTPUT = @<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $word $definition .
Very simple, but it doesn't do exactly what I am looking to do. As you can probably tell, it's a simple word/definition output. The problem is that the definition is often longer than the allocated space and therefore gets truncated.

I'm looking for a way to get output that will continue the definition onto the next line. Sort of a multi-line definition (if needed) for each word.
word1 definition11111111111111111111111111111111 111111111111111111111 word2 definition22222222222222222222222222222222 222222222222222222222
Any suggestions? -Eric

Replies are listed 'Best First'.
Re: new to format
by VSarkiss (Monsignor) on Apr 25, 2002 at 21:26 UTC

    The key is the caret in the first line and the double-tilde in the second line as shown here:

    format OUTPUT = @<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $word, $definition ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $definition .
    More information at perlform.

    BTW, probably just a copy-and-paste thing, but you forgot the comma to separate the variables. I added it.

    HTH

      Damn, you monks are fast with the replies. Thanks for the info. About the comma, the code I have without the comma seems to work just fine. Is it necessary? -Eric

        You should use the commas. If you use -w, it will tell you that omitting them is deprecated. And if you have expressions instead of simple variables, you'll very likely get a syntax error if you leave them out.

        You're welcome. If the advice was helpful, consider making a donation. ;-)