my @paths = qw[ filepart1 filepart2 ... filepartN ]; foreach (@paths) { my $path = `find /partial/prefix/path -name "*$_*"`; # ... }