foreach $username(@arry){ next if $username =~ /ipw\.[0-9]/i; next if ($username =~ /ipw\.a[^a-m][a-z]*/); print "$username \n";