in reply to How to reset a variable for each file inside a while( <> ) loop?

As almut said, $ARGV hold the current file name, so you could get the number of lines for each file into a hash with:
while (<>) { $lines{$ARGV}++; ... }
Or use the change in $ARGV to detect a new file, for example to print a banner:
while (<ARGV>) { if ( $ARGV ne $current_file ) { print "\n","-" x 20, " $ARGV ", "-" x 20, "\n"; $current_file = $ARGV; $files++; } print; }