* Luinrandir Hernson ([EMAIL PROTECTED]) wrote:
> Below is the code i'm using to filter out non alphanumeric charecters... however
>when i type....
> ?!$BOB
> yeilds this:
> -_3f_21_24bob-
What's happening is that your string '?!$BOB' is being URL encoded
(standard CGI procedure) and being translated to '%3F%21%24BOB'.
%3F = ?
%21 = !
%24 = $
So if you take youre string '%3F%21%24BOB' and run in through your
regex, you get the '_3f_21_24bob' you're seeing.
And because you're parsing it yourself you're seeing all this uglyness.
You should really try using CGI.pm because it handles all the URL
decoding for you.
#!/usr/bin/perl -w
use strict;
use CGI;
my $cgi = CGI->new();
# it parses everything for you... just ask by name
# This is the name I gave it in the
my $email = $cgi->param('email');
# your regexes
$email =~ tr/A-Z/a-z/;
$email =~ tr/a-z0-9/_/c;
# print the "Content-Type: text/html\n\n" message
print $cgi->header;
print "-$email-";
With this example we get '-___bob-' just like you would expect.
Regards,
-biz-
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]