Tom Kinzer <[EMAIL PROTECTED]> wrote:
> Try this:
>
> Caveat: This all assumes LOTS about the format of your data being
> consistent, and so should be treated as a "quick and dirty" as opposed to
> anything resembling a robust application... I'm not sure what your
> intention with the script is, but is worth mentioning.
>
> -Tom Kinzer
>
> __SNIP__
>
> my $input = '/appl/log/200301130.txt';
> my $total;
> die "Usage: Arg1: Input File to Scan."
> unless $input;
>
> open IN, "< $input" or die "Unable to open $input for reading, $!,
> stopped";
>
>
> while ( <IN> ) {
> if ( / Document Format/ ) { last };
> }
>
> while ( <IN> ) {
> if ( / Total: -------------/ ) { last };
> }
>
> while ( <IN> ) {
> if ( /^\s*\d+/ ) {
> chomp;
> s/\s*(\d+)\s*/$1/;
> $total = $_;
> printf "Total: %010s\n", $total;
> last;
> }
> }
>
> close IN;
>
> __END__
Don't you need to do a
seek(IN,0,0)
in between each while loop?
Why have three while loops; why not incorporate this into a single loop?
-Jeff
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>