if(-d BUS) #### if ( $_ eq "BUS" and -d "$path/$_" ) # string equality test if ( /^BUS$/ && -d "$path/$_" ) # pattern match on $_ #### use strict; use warnings; my $path='/home/something/something/something'; if ( -d "$path/BUS" ) { opendir my $VEH, "$path/BUS" or die"couldnt open the directory\n"; while(readdir $VEH ) { print "$_\n"; } }