Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Validate newline delimited email list

by ikegami (Patriarch)
on Jan 12, 2007 at 22:31 UTC ( #594475=note: print w/replies, xml ) Need Help??


in reply to Re^4: Validate newline delimited email list
in thread Validate newline delimited email list

Sounds like you added the call to the function, but not the function itself??
  • Comment on Re^5: Validate newline delimited email list

Replies are listed 'Best First'.
Re^6: Validate newline delimited email list
by philosophia (Sexton) on Jan 12, 2007 at 22:33 UTC
    i've added the function. adding 'sub trim;' to the top of my script gets rid of this error.

      i've added the function.

      Perl disagrees.

      adding 'sub trim;' to the top of my script gets rid of this error.

      sub trim; shifts the problem. As you can see, it didn't fix anything.

      I'm not sure why you keep making me guess. If *your code* doesn't work, show it!

        thanks. the current version of the code
        sub trim; ... my ($error) = 0; my @other_addresses = map trim, split( /\n/, $email_list ); foreach (@other_addresses) { my $ok = Email::Valid->address($_); $error++ if(!$ok); print "address($_) = $ok<br>"; print "error ".$error."<br>"; } $error_message .= "$error Email list contains an invalid email add +ress.<br>" if ($error > 0); ... sub trim { my ($s) = @_; for ($s) { s/^\s+//; s/\s+$//; return $_; } }
        gives me
        address() = error 1 address() = error 2 There was an error with your form submission. 2 Email list contains an invalid email address.
        it looks like $_ is not getting populated with an email address.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://594475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-06-25 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (81 votes). Check out past polls.

    Notices?