Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: formats output \r\n question (@)

by tye (Sage)
on Jun 28, 2006 at 05:54 UTC ( [id://557935]=note: print w/replies, xml ) Need Help??


in reply to formats output \r\n question

format STDOUT = @<<<<<<<<<­<<<<<<<<< @<<<<<<<<<­<<<<<<<<@ $name, $home, "\r" .

- tye        

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

      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}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://557935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-20 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found