Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: new file per line output

by Laurent_R (Prior)
on Dec 31, 2013 at 18:45 UTC ( #1068813=note: print w/ replies, xml ) Need Help??


in reply to new file per line output

Instead of

foreach $line (<LOGFILE>)
try:
while (my $line = <LOGFILE>)

There are many other problems in your script, but that's probably why you're not looping as you want on the file lines.

EDIT: davido said it all and still succeeded to post one minute before me. ;-)


Comment on Re: new file per line output
Select or Download Code
Re^2: new file per line output
by davido (Archbishop) on Dec 31, 2013 at 18:51 UTC

    The only impact that change has is to stop the "behind the scenes" slurping of the input file. But unless Perl itself is broken, both will iterate over the file just fine.

    EDIT: I probably got a head start. ;)


    Dave

      Well, since I am working daily with files that have sizes in the dozens of GB ranges, it does make a real difference to me. Slurping a file into memory is usually not an option for me. But, granted, I might have overreacted.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (19)
As of 2015-07-07 15:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls