Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Validate newline delimited email list

by ikegami (Patriarch)
on Jan 12, 2007 at 21:50 UTC ( [id://594467]=note: print w/replies, xml ) Need Help??


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

"test@test.com " is indeed bad. Notice the trailing space? It's easy to fix the address, though.

sub trim { my ($s) = @_; for ($s) { s/^\s+//; s/\s+$//; return $_; } } ... my @other_addresses = map trim, split( /\n/, $email_list ); ...

Replies are listed 'Best First'.
Re^4: Validate newline delimited email list
by philosophia (Sexton) on Jan 12, 2007 at 22:20 UTC
    i put the above in my code and

    sub trim;

    at the top of my script.

    I get
    address() = error 1 address() = error 2 There was an error with your form submission.
Re^4: Validate newline delimited email list
by philosophia (Sexton) on Jan 12, 2007 at 22:44 UTC
    shouldn't chomp() remove the trailing space? i've tried chomp($_) and it looks like the space is still there.

    i've tried your suggestion above, and it doesn't seem to populate $_
      No. chomp doesn't remove trailing spaces.
Re^4: Validate newline delimited email list
by philosophia (Sexton) on Jan 12, 2007 at 22:08 UTC
    this gave me a software error, not sure how to deal with it:

    Bareword "trim" not allowed while "strict subs" in use at...
      Sounds like you added the call to the function, but not the function itself??
        i've added the function. adding 'sub trim;' to the top of my script gets rid of this error.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-18 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found