foreach $artefact (@objects) { $artefact=~ s/.bar//; print "artefact to be deployed is $artefact\n"; my $file = "C:/abc/def/klm/Properties/$artefact.properties"; open my $input_fh, '<', $file or die "failed to open '$file' $!";