At the moment I have this code snippet...
#!/usr/bin/perl while(<>) { chomp; s/^\s+//; s/\s+$//; next if /^$/; #Next if empty... #do something with the text copied to this loop... #just to do something as an example... print "$_ \n"; }
It's working fine and is doing what I want it to do - with one little exception... If I copy not just one line but multiple lines to the loop, it just prints the first of this lines. If i want it to print more of this lines I have to press enter repeatedly till it is done... if I copy or write anything to he loop until the lines are all done it mixes them up... But I want it to be able to process more then one line at a time - example: What it does:
#1st Example a #input (a) a #output #2nd Example a #input (a newline b pasted to the loop) ba #input and output #press enter b #output #3rd Example a #input (a newline b pasted to the loop) ba #input and output c #input (c) bc #output and output
What I want it to do:
a #input a #output a #input (a newline b pasted to the loop) b #continuing a #output b #without pressing enter again
Problem is - I'm not sure what to change because I can't find out why this is happening... Any idea?

In reply to Copy multiple lines to a loop by eyekona

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.