Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Text match

by kennethk (Abbot)
on Oct 14, 2009 at 14:40 UTC ( [id://801100]=note: print w/replies, xml ) Need Help??


in reply to Text match

It's certainly be helpful if you posted some code - see How do I post a question effectively?. Do you have all your lines in an array? Do you have the whole file in a string? The solution depends strongly on these questions. Assuming you want to do it streaming, perhaps you mean something like:

while (defined (my $line = <$file>)) { push @cache, $line; shift @cache if @cache > 20; print join "\n", @cache if $line =~ /test/; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found