Advertisement
cd62131

mail address check

Mar 7th, 2014
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.45 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use utf8;
  5. use open qw(:encoding(utf8) :std);
  6. use feature 'say';
  7. my @address = qw(aaa@test.local aaa.bbb@test.local hoge@test.local ccc@test.jp);
  8. foreach (@address) {
  9.   my ($name, $domain) = split '@';
  10.   if ($domain !~ /\Atest\.local\z/) { say; next; }
  11.   if ($domain =~ /\Atest\.local\z/) {
  12.     if ($name =~ /\Ahoge\z/) { say; next; }
  13.     if ($name =~ /\./) { say; next; }
  14.   }
  15.   say $_ , " invalid";
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement