> Validating in Perl?!  I'm interested!

Of course, perl has regular expressions far superiour
to anything Javascript offers.  In fact, I once looked
at validating in Javascript and decided the character
manipulation was far too much effort.

You seem surprised... why?

> Can you send me some sample scripts which validates
> in perl?!

Assuming CGI and param() is in use:

use CGI::Carp;

my $username = param("username") || "";
my $email    = param("email")    || "";

carp "Invalid username\n"
  unless $username =~ /^[a-zA-Z_]{2,8}$/;

carp "Invalid email\n"
  unless email_ok($email);


---

This seems too easy... another variation on this
allows much more secure scripts - again by using
regular expressions and perl taint mode.  BTW,
you must be fairly proficient with regular
expressions to get the most out of Perl.

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to