if ($file_path =~ /defines|sccpch|sms81154|sms97767/) { next; } elsif(!($file_path =~ /defines|sccpch|sms81154|sms97767/)) # This is redunant { if (open(FILES, $file_path)) # use the -f operator to test # files existance, or -W to test # if it can be written to { if (!($file_path =~ /\.lfa|\.zip|\.txt|UASTG/)) { print (DATA "$file_path\n"); } } else { die ("Could not open[$file_path], $!\n"); } ## The above is redunant... it would be better stated as: if ($file_path =~ /defines|sccpch|sms81154|sms97767/) { next; } else { if (-f $file_path) { if (!($file_path =~ /\.lfa|\.zip|\.txt|UASTG/)) { print (DATA "$file_path\n"); } } else { die ("Could not open[$file_path], $!\n"); } }