dru145 has asked for the wisdom of the Perl Monks concerning the following question:
Use of uninitialized value in split at ./temp.pl line 258. Use of uninitialized value in string at ./temp.pl line 290. Use of uninitialized value in concatenation (.) at ./temp.pl line 290. Can't use an undefined value as a symbol reference at /usr/lib/perl5/s +ite_perl/5.6.0/Mail/Sender.pm line 832.
sub match { my (@newemails, @emails); # Email addresses to ignore my $ignore = qr(([-.\w]+\@apnic\.[com|net]) | ([-.\w]+\@uu\.net) | ( +hostmaster\@nic\.or\.kr) | ([-.\w]+\@[RIPE\.NET|ripe\.net]) | ([-.\w]+\@iana\.org) | (NOC\@SPRINT\.NET); # Save all emails from whois query to an array @emails = $result =~ m/([-.\w]+\@[-.\w]+)/g; my %saw; @emails = grep(!$saw{$_}++, @emails); #remove duplicates # Remove all ignore emails and save to new array foreach (@emails){ next if $_ =~ $ignore; push(@newemails, $_); } #Save the email and domain portion to separate vars my ($email, $domain) = split(/\@/, $newemails[0]); #Run the mail sub for each email address &mail($newemails[0], $domain); } *Note: I know my regex will not match 100% of emails, but I'm happy wi +th 75 - 90%. It's been working out well so far.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How not to pass undef variables
by count0 (Friar) on Jan 10, 2002 at 22:02 UTC | |
|
(jeffa) Re: How not to pass undef variables
by jeffa (Bishop) on Jan 10, 2002 at 22:07 UTC | |
|
Re: How not to pass undef variables
by danger (Priest) on Jan 10, 2002 at 22:12 UTC | |
|
Re: How not to pass undef variables
by gav^ (Curate) on Jan 10, 2002 at 22:43 UTC |