use File::Spec; ... my $pat = File::Spec->catfile($var1,$var2,$var3,'*.ksh'); for(glob $pat) { print "$_\n"; }