Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Help needed in reading a very large file line by line

by trizen (Friar)
on Feb 28, 2012 at 15:06 UTC ( #956682=note: print w/ replies, xml ) Need Help??


in reply to Help needed in reading a very large file line by line

For very long lines, you can try something like this:

open my $fh, '<', $filename; my $line = ''; my $track = 0; my $max_line_length = 1024; # or whatever while (defined(my $char = getc $fh)) { $line .= $char; if (++$track == $max_line_length or $char eq "\n") { print $line; $line = ''; $track = 0; } } close $fh;


Comment on Re: Help needed in reading a very large file line by line
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-04-21 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (492 votes), past polls