opendir( my $dh, $dir) or die $!; while ($file = readdir( $dh )) ... open( my $fh, $FullName) or die ... #### sub ScanDir { local( DIR, FILE ); ...