PsychoSpunk has asked for the wisdom of the Perl Monks concerning the following question:
$hashref = { key => ['value1', 'value2'], key2 => ['value3', 'value4'] + };
This is a nice little conversion trick where the keys are known CGI parameters, the first value in the array refers to a specific database column, and the second is for spitting out something nice if there's an error. This allows me to use one piece of code to do similar tasks in multiple tables in the database.
Now, I'm running into a new problem. I now have some CGI parameters that will not be known until runtime. I want the frontend script to admit these new parameters into the above reference based on what I do know about the parameters before runtime. I think this should work, but my eyes are playing tricks on me and making my brain stare in disbelief. Here's the admittance code:
foreach $param ($cgi->param) { if ($param =~ /^abc_/) { $hashref->{$param} = ['column', 'text']; } }
Why do I have the feeling of disbelief? Am I just crazy? Thanks for anyone who can see whether I've correctly addressed all the levels of anonymity here.
PsychoSpunk
P.S. I would just run this but I'm in the middle of a very big script that this is located in, and if it broke later, I would just post this message but with the statement that goes, "I can't make this work." This message is simply proactive debugging. :) ALL HAIL BRAK!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Referents Anonymous.
by chromatic (Archbishop) on Sep 30, 2000 at 00:23 UTC | |
by PsychoSpunk (Hermit) on Sep 30, 2000 at 00:39 UTC |