in reply to How to reset a variable for each file inside a while( <> ) loop?
Or use the change in $ARGV to detect a new file, for example to print a banner:while (<>) { $lines{$ARGV}++; ... }
while (<ARGV>) { if ( $ARGV ne $current_file ) { print "\n","-" x 20, " $ARGV ", "-" x 20, "\n"; $current_file = $ARGV; $files++; } print; }
|
---|