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

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        

Replies are listed 'Best First'.
Re^4: formats output \r\n question (@)
by shmem (Chancellor) on Jun 28, 2006 at 06:56 UTC
    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}