Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Validating the contents of scalars using an array based list

by InfiniteSilence (Curate)
on Apr 03, 2003 at 22:30 UTC ( [id://247907]=note: print w/replies, xml ) Need Help??


in reply to Validating the contents of scalars using an array based list

I dunno, but doesn't the cgi param function already return an undef when you pass it a bogus param name? In this case wouldn't it be okay to do the following without extra hash creation:
#!/usr/bin/perl -w use strict; use CGI; #using params in a file 'cause I don't have a webserver handy open(INPUTFILE,"c:\\temp\\inputs.dat"); my $cgi = new CGI(\*INPUTFILE); close(INPUTFILE); my @keywords = qw~man dog horse barker~; foreach(@keywords) { if (!defined($cgi->param($_)) || $cgi->param($_) eq ' ' || $cgi->p +aram($_) eq '' ) { print "Nothing there for $_!\n"; } } #contents of the .dat file are #man=horse #dog=man #horse=

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found