I don't think you need to put $email in quotes to do the check, but it works if you do. Try this:
if $email =~/@.*@/g || $email =~ /\n/s;
Hope it helps, Tracy
New to the list, so apologies if I post incorrectly.
On Feb 28, 2004, at 11:50 PM, Camilo Gonzalez wrote:
Perl dudes,
I'm trying to match a newline to dissuade spammers from hijacking my script. This is what I have
#!/usr/local/bin/perl -wT use CGI::Carp qw(fatalsToBrowser); use strict; use CGI; my $cgiobj = new CGI; $ENV{PATH} = "";
#Get parameters my $name = $cgiobj->param('name'); my $address = $cgiobj->param('address'); my $email = $cgiobj->param('email'); die &Print_Error if "$email" =~ /@.*@/g || /\n/s;
It finds the extra '@' but ignores any \n I put in the email field. Any ideas?
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>