in reply to Re: Using '/r' with '~~ $var' in format
in thread Using '/r' with '~~ $var' in format

Well, you are right that a practical answer is to change the approach. But there's stuff behind the question that you can't see ;-)

Quoting Larry/The Camel Book,
The truly desperate can generate their own format on the fly...

When my program runs, I won't know what is in the $line string, i.e. it won't always be data types like sig and prep_by. (And I also build the FORMAT definition in a subroutine but I thought that would distract from my question.) Practically speaking, the data will usually be paragraphs with newlines for separators, and it's these blank lines that I particularly want respected. But as my Version D shows, I'd really like any newline within $line to be respected.

  • Comment on Re: Using '/r' with '~~ $var' in format--"formats on the fly"

Replies are listed 'Best First'.
Re: Re: Using '/r' with '~~ $var' in format--"formats on the fly"
by grep (Monsignor) on Nov 02, 2002 at 00:01 UTC

    What about ditching format? It sounds like your needs will be surpassing what format will do easily (and more importaintly if you do pull it off, it sounds like a maintainence nightmare).

    Template Toolkit sounds like a great fit for you. TT is designed to template any job not just HTML (as long as you don't need pagination)



    grep
    Mynd you, mønk bites Kan be pretti nasti...
      It looks like Template Toolkit will be useful for the next stage in my process in which I officially present the data and the user doesn't need it in Word. Thanks for the tip. For this particular stage, I just need to create a rough draft and using 'format' statements will be sufficient (esp. since I've already written the code :-) So the question remains, how might I use \r to achieve embedded newlines that will be respected by '~~ $var' lines within a format statement?