for (@files) { next if /pattern/; #file didn't match pattern, so create it open(FH,">$_"); #do something with FH }