my $count = 0; $count++ foreach glob "$dir/*.dat";