Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Variable Variables

by marius (Hermit)
on Dec 05, 2000 at 11:03 UTC ( [id://44968]=note: print w/replies, xml ) Need Help??


in reply to Variable Variables

thanks for the insight, all.. ++'s all around. Valuable lessones when learning perl: hashes can be used for "darn near everything". I hadn't even thought of using hashes for the project, but it's obviously the superior approach.

I think I'm gonna end up using alakaboo's $query->Vars() method. Didn't know about that, and ended up going from CGI.pm 2.46 to 2.76 anyway. I guess that needed an update anyhoo.

Replies are listed 'Best First'.
Re: Re: Variable Variables
by gryphon (Abbot) on Dec 05, 2000 at 22:03 UTC

    I don't know if this will help at all, but you could try either:

    use strict; use CGI qw(header param); print header; print "The variable is: ", param('variable_name'), "\n";

    This will cut off a line, and you just have to reference param() everywhere.

    The other option requires that you don't use strict, but it's fairly nifty:

    use CGI qw(header param); print header; foreach (param) { $$_ = param($_); }

    With this, you'll end up with all the variables translated into Perl variables. For example, a form with item named item will become $item in your script. Someone somewhere said this could potentially be a security risk, but I'm not sure how yet.

    Hope this helps. BTW, if anyone knows why the above is bad, please let me know. Thanks.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found