The input must be an email address and I am checking it the following
way:
 
  print "Enter an address to replace: ";
  chomp (my $search = <STDIN>);
        unless ($search =~ /@/){
                die "Search field must be an email address!\n";
        }
  print "Enter a replacement address: ";
  chomp (my $replace = <STDIN>);
        unless ($replace =~ /@/){
                die "Replacement field must be an email address!\n";
        }
 
This does work but I am sure there must be a better way.  The whole
program is a search and replace utility for email addresses on all our
mailing lists so when someone changes their address I don't need to
change it manually on 20 lists.  Does anyone see a better way of doing
this?
 
Dylan


Reply via email to