Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: How to push the previous line based on the current line to two different files.

by kcott (Archbishop)
on Sep 14, 2012 at 07:19 UTC ( [id://993665]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to push the previous line based on the current line to two different files.
in thread How to push the previous line based on the current line to two different files.

"Avoid needless slurping. Use while (<DATA>) instead of introducing an extra variable, slurping into it and using a for loop."

The OP (suno) is using a for loop to read through data in the @Read_Array array - that's a variable suno already has, not an extra variable.

No indication is given of how that array is populated.

my @Read_Array = <DATA>; (in my code) initialises @Read_Array with the data shown.

suno's question is not about how to capture the data; it's about how to process it once it's in @Read_Array.

Finally, suno specifically says "... without using while loop ...". I don't know why that is requirement: perhaps addressing your data capture comments to suno would be more appropriate.

-- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-20 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found