foreach my $k (@a) { my $x = `find . -name $k.* -print`; ... do something with $x ...; }