in reply to Re: Re: format question
in thread format question


Okay, I think I see the cause of the confusion. The tilde ~ does eliminate blank lines. However, setting $^A = "" does not reset the accumulator. You have to print it to do that.

Consider the following example based on your code snippet:

#Something tells me we're not programming in Perl anymore Toto. ;-) for (1..2) { print "Run: ", $_, "\n"; $^A = ""; formline(<<'OUTPUT_TABLE', 1, 2); @<<<<<<< @<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<<<<~ OUTPUT_TABLE $out .= $^A; print $out; } for (3..4) { print "Run: ", $_, "\n"; $^A = ""; formline(<<'OUTPUT_TABLE', 1, 2); @<<<<<<< @<<<<<<<<<<<< @<<<<<<< @<<<<<<<<<<<<~ OUTPUT_TABLE print $^A; }
This gives the following output. Note the additional line in Run 2.

Run: 1 1 2 Run: 2 1 2 1 2 Run: 3 1 2 Run: 4 1 2
Therefore, you will have to re-organise your code to make sure that you print $^A.

--
John.

Replies are listed 'Best First'.
Re: Re: Re: Re: format question
by Anonymous Monk on Nov 09, 2001 at 08:42 UTC
    I get it ;)
    THANKS a TON !!! I can tell you spent time on this !