in reply to Efficiently parsing a large file
Then at the end, you just go through the hash, and print all entries that aren't in the state complete.if (m/(/\w{6}-\w{5})\s+begin/) { $state{$1}='begin'; } elsif (m/(\w{6}-\w{5})\s+doing-work/){ if ($state{$1} eq 'begin') { $state{$1}='doing'; } else { warn "$1: doing work without being\n"; } } elsif ((m/\s+(\w{6}-\w{5})complete/) { if ($state{$1} eq 'doing') { $state{$1}='complete'; } else { warn "$1: got complete, but state=\"$state{$1}\"\n"; } }
That way, you only need to go through the file once.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Efficiently parsing a large file
by pelagic (Priest) on Apr 08, 2004 at 21:02 UTC | |
by jfroebe (Parson) on Apr 08, 2004 at 21:15 UTC | |
by pelagic (Priest) on Apr 08, 2004 at 21:23 UTC | |
by neilwatson (Priest) on Apr 08, 2004 at 22:49 UTC | |
|
Re: Re: Efficiently parsing a large file
by jfroebe (Parson) on Apr 08, 2004 at 21:01 UTC | |
by Art_XIV (Hermit) on Apr 08, 2004 at 21:14 UTC | |
|
Re: Re: Efficiently parsing a large file
by neilwatson (Priest) on Apr 08, 2004 at 20:32 UTC |