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

Re: split file and search respectly

by prasadbabu (Prior)
on Jan 12, 2007 at 04:12 UTC ( [id://594307]=note: print w/replies, xml ) Need Help??


in reply to split file and search respectly

Hi xiaoyafeng,

You have to take a look at Tie::File and perlre.

From the documentation:

The file is not loaded into memory, so this will work even for gigantic files.

A sample code to proceed....

use strict; use warnings; use Tie::File; my @file; tie @file, 'Tie::File', "test.txt" or die "$!"; for (0..5) { print "ORA is present\n" if $file[$_] =~ /ORA/; }

update: added code.

Prasad

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-24 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found