Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Copy multiple lines to a loop

by hippo (Curate)
on May 20, 2014 at 17:00 UTC ( #1086824=note: print w/ replies, xml ) Need Help??


in reply to Copy multiple lines to a loop

Standard input from your terminal is line-buffered so your loop will process each line as it arrives.

To see the output you have shown you could either disable the line-buffering of STDIN (I've never done that and with pretty good reasons) or disable line-buffering of STDOUT (less problematic) or else save your output in the loop to a variable rather than printing directly and then print the entire variable on loop exit.

In any of these cases you will need to send the EOT character to notify the script of the end of input. This is typically ^D


Comment on Re: Copy multiple lines to a loop
Download Code
Re^2: Copy multiple lines to a loop
by eyekona (Acolyte) on May 21, 2014 at 08:02 UTC
    Use a variable... Yes sometimes I'm an idiot. Stuff like this happens when admins try to be programmers...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-09-22 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (185 votes), past polls