if ($mail_id =~ /\A(box1\.yourcompany\.com|box2\.yourcompany\.com|box3\.yourcompany\.com|other1\.othercompany\.com|other2\.elsewhere\.com)\z/ ) { print "matched\n"; }