TonySoprano has asked for the wisdom of the Perl Monks concerning the following question:
I am reading one big text file. It contains several lines specifing events. I will use the actual values. Its a combat log from a game I am parsing.
Here is what I want to do, read the whole file, and find the bits where the combat starts, this is working, I match agains /EnterCombat/.
I want to keep parsing the data after the match, untill I find ExitCombat. I want to find all the targets in between EnterCombat and ExitCombat. This is so I can find the 'boss' fights in the game.foreach my $line (@AR_WHOLE_FILE) { if ( $line =~ /EnterCombat/ ) { ( $timestamp ) = split ($line); print $timestamp . "\n"; } }
I need some hints on how to approach this, I dont know how to continue to parse when I am already parsing by line, so how do I advance while I am already in a foreach loop..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split files based on regexp
by RichardK (Parson) on May 17, 2012 at 11:20 UTC | |
|
Re: Split files based on regexp
by druthb (Beadle) on May 17, 2012 at 11:26 UTC | |
by roboticus (Chancellor) on May 17, 2012 at 12:11 UTC | |
by druthb (Beadle) on May 17, 2012 at 12:43 UTC | |
|
Re: Split files based on regexp
by ww (Archbishop) on May 17, 2012 at 14:15 UTC | |
|
Re: Split files based on regexp
by Anonymous Monk on May 17, 2012 at 11:12 UTC |