CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Couple of questions



Jan 21, 2000, 6:52 AM

Post #1 of 3 (5994 views)
Couple of questions Can't Post

Ok, I'm writing a custom ordering script, basicly a from -> email script that does a bunch of calculations and reads and writes from some databases.

Now I'm trying to prevent invalid characters and this is the function that is supposed to be doing it.
sub decode_input { # Decodes input, Stores Input, Checks for input Validation, Bails on first bad

# Decode the Input from the order Gateway #
# Store in A. Array "%OrderInput" #

# Check for all required fields, bail on first bad #
foreach $to_check (keys(%OrderInput)) {
if ($OrderInput{$to_check}=(/([;<>\*\|'&\$!#\(\)\[\]\{\}:`"])/) &#0124; &#0124; $OrderInput{$to_check} eq "") {
$error_required = "$to_check is missing or contains invalid characters";

However It don't work.. it runs &required_bail if $OrderInput{$to_check} eq "" but if you put invalid characters in it (like : (that is my database delemiter..verybad) then it just loads and run a total different sub-routine that isn't even defined in there.. it loads up a sub-routine for password missmatch.

Any ideas as to what is wrong in that sub? any help would be appreciated. Thank you.


Jan 21, 2000, 7:38 AM

Post #2 of 3 (5994 views)
Re: Couple of questions [In reply to] Can't Post

The problem is you're using the = operator, for assignment, instead of the =~ operator, for pattern matching.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

if ($string = /[aieou]/i) {
# $string is set to 1 or 0
# depending on whether or not $_
# has any vowels in it.
# and if $string is set to 1,
# then this if block gets executed

if ($string =~ /[aeiou]/i) {
# if $string has any vowels in it,
# then this if block gets executed


Jan 21, 2000, 7:56 AM

Post #3 of 3 (5994 views)
Re: Couple of questions [In reply to] Can't Post

Thank you

it works


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives