On Wednesday 22 August 2001 11:58, webmaster wrote:
> #!/usr/bin/perl
> $REPORT_file="report.htm";
> $ imput_file=$ARGV[0]||'imput.dat';
> unless (-e $imput_file)
> {
>     die "$0: error:missing file: $imput_file";
> }
> open (IN, $imput_file) or die "$0 : error: $imput_file: $!";

All of this ( except the #! line ) can be replaced by this:

        open( IN, shift ) or die( "Open failed: $!" );

> #print $imput_file;
> my $line;
> while ($line=<IN>)
> {
>   chomp $line;
>   print "processing line $. \n";
> }

If I understand the question, you want to be told by the while look what line 
is processing and then, at the end, be told how many lines were processed.

I'd use a counter to keep track of it all:

my $count = 0;
while( <IN> ){
        $count++;
        print "Processing line $count\n";
}
print "Processed $count lines\n";

Also, use strict and use warnings, you'll be happy to did - maybe not now, 
but someday.

Regards,

Troy



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to