http://qs321.pair.com?node_id=268132

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that outputs data and the total count. Please advise how I can get the count to appear first before the data output. Right now the count comes up after the data output on the very last page. I need the count to show BEFORE the data output. Is that possible??
use File::Find; my $ct = 0; sub fetcher { if( $_ =~ /\.html?$/) { my $name = $File::Find::name; open ( F, $name ) or die "$!: $name\n"; while( $line = <F> ) { for $i ($line =~ /stuffhere)/gi ) { print "$i\n"; $ct++; } } close F; } } #print "\n\nTotal Count = $ct\n\n"; also tried putting count here and + it still prints count after data find( \&fetcher, "/directory" ); print "\n\nTotal Count = $ct\n\n";