in reply to Pattern Match in @array

This solves both your problems (if I interpret you correctly):
foreach my $file (grep { !-e } @files) # The grep returns all the elem +ents of the array # for which the sub ( { !-e } ) + returns true, which it # will only if $_ (the array el +ement being tested) does not # exist. If you want it to exi +st and be a # regular file (as opposed to a + directory, FIFO, etc.) # use -f. { local *FH; # To make sure we don't clobber + FH. open FH, ">>$file"; # In case the file got created # in the meantime, we use the a +ppend operator to avoid # clobbering data. close FH; # And then we close it. }
See also: foreach grep local open -X.