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

Re: Large file processing

by pc88mxer (Vicar)
on Jul 14, 2008 at 04:51 UTC ( [id://697384]=note: print w/replies, xml ) Need Help??


in reply to Large file processing

Your approach seems pretty reasonable. Just one pointer:
{ local($/) = "...end of paragraph delimiter..."; while (<F>) { my $line = process_paragraph($_); print OUT2 $line; } }
This localizes the value of $/ so that it gets reset upon leaving the block. It's a defensive measure so that you don't get surprised later on when you expect $/ to contain the default value.

Also, note that in the while loop, $_ will contain the end of paragraph delimiter. You can chomp it or just leave it, depending on what your processing routine does.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found