Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Newbie Text Parsing Question

by Brovnik (Hermit)
on Jul 06, 2001 at 00:49 UTC ( #94275=note: print w/ replies, xml ) Need Help??


in reply to Newbie Text Parsing Question

My version, editted from the first reply.

foreach my $fn (<*.log>) { # start with 3 entries to ensure 3 lines my @fifo = ('','',''); open I, $fn or warn("Couldn't open $fn: $!"), next; while (<I>) { #Add current line on one end and remove the first entry push(@fifo,$_); shift(@fifo); if (/monk/) { print '-'x40 ,$/; print "From file [$fn]:\n\n"; print @fifo; print '-'x40 , $/; } } close I; }

--
Brovnik


Comment on Re: Newbie Text Parsing Question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-09-02 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls