for my $dir (glob ){ next unless -e my $conf = $dir.'/config.pl'; open DATA, $conf || die "Could not open $conf"; my @data = ; #and do something with it close DATA; }