Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: What wize monk can help?

by DamnDirtyApe (Curate)
on Nov 27, 2002 at 22:00 UTC ( [id://216190]=note: print w/replies, xml ) Need Help??


in reply to Print preceding line from text database

Tie::File will serve you well here.

use Tie::File ; my $data_file="learn.data"; my $search_for = 'foo' ; tie my @raw_data, 'Tie::File', $data_file or die ; for ( my $row = 0 ; $row < $#raw_data; ++$row ) { if ( $raw_data[ $row ] =~ /$search_for/ ) { my $matching_row = $raw_data[ $row ] ; my $previous_row = $raw_data[ $row - 1 ] ; my $following_row = $raw_data[ $row + 1 ] ; ### And so on and so forth... } }

_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Log In?
Username:
Password:

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

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

    No recent polls found