my @log_dir = glob "/usr/home/*/logs"; for ( @log_dir ) { do_something if -d $_ }