for (my $i = 0; $i <= $#_; $i++) { next unless defined $_[$i] and $_[$i] =~ /^(.+?)\.(zip|t?gz|tar|bz2?|tbz)$/i or $_[$i] =~ .... and so on