in reply to Re: formats output \r\n question (@)
in thread formats output \r\n question

Did you test that? Doesn't work. If it did, the OPs solution had been working in the first place.
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^3: formats output \r\n question (@)
by tye (Sage) on Jun 28, 2006 at 06:39 UTC

    Yes, I did test it. I see now how my test was flawed. Thanks.

    This is another alternative, but I agree that I don't see what the advantage of this is over printf:

    binmode STDOUT; while( ... ) { my( $name, $home )= ...; formline "@<<<<<<<<<­<<<<<<<<< @<<<<<<<<<­<<<<<<<<\r", $name, $hom +e; print $^A, $/; $^A= ""; }

    This also suggested another "solution" that works but is quite undesirable due to it being fragile: Just include an extra literal carriage return on the end of each of the format's "picture" line(s) in the script's source code.

    - tye        

      It only has "grafical" advantages over printf, and possibly only whilst writing the code, and only if parts of the format are conditionally present. You could design a complex format first, tweak it until you have the picture right. Then make all into formline statements and generate the final format on the fly. I have done so generating reports of SAP interface definitions, which are a great help if you have to deal with that monster software...
      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}