Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Printing text from scrolled window?

by Fletch (Bishop)
on Jul 28, 2006 at 13:00 UTC ( [id://564352]=note: print w/replies, xml ) Need Help??


in reply to Re: Printing text from scrolled window?
in thread Printing text from scrolled window?

/boggle

Erm, why split to immediately rejoin with the same character? print $scroll->Contents(), "\n"; (not being familiar with Tk that may require a scalar after the print, but at any rate it should accomplish the same thing without the extra round trip).

Replies are listed 'Best First'.
Re^3: Printing text from scrolled window?
by GrandFather (Saint) on Jul 28, 2006 at 18:42 UTC
    OP: "Preferably (if it is possible) the text could be extracted as an array ..."

    DWIM is Perl's answer to Gödel

      Oop, quite right. I missed that part of the original question.

      If the OP's trying to post-process the contents line-by-line before printing that's something completely different of course, but I didn't get that from the overall question (and it only would seem that way when you actually read that one un-parenthetical parenthetical aside which I missed).

      Otherwise the objection still remains: if you're just trying to print the contents out somewhere, it's unnecessary work to split to lines just to add back newlines.

      Update: And even if you are post-processing things from an array I'd tend to use something along the lines of for( @lines ) { my $line = munge($_); print $line, "\n"; } rather than joining for one big print just in the interest of efficiency.

      Useless observation: Posting #2000. Break out the crepe paper and confetti.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-25 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found