Ask a Question related to PERL Miscellaneous, Design and Development.
-
Paanwa #1
List Hash 'Field' Names
I am trying to write more automated code - either I am a lazy typist or am
just trying to get more with it!
I have a hash I define; I have a form with textboxes for each hash elements.
When the form is submitted the user gets a chance to review their data prior
to finalizing (writing to file).
The form is running from the same piece of code; I would like it to use the
hash values if it is the first time through (the hidden form object named
cycle is set to 0), but use the submitted (either changed or left alone)
data for the second time through - which is the 'review' part mentioned
above (cycle is set to 1).
I really don't want to set my form values manually:
(summary, not actual code)
if (param('cycle') = 0)
{
set Address1 = $hash{$key}{Address1};
}
else
{
set Address1 = param('Address1');
}
I would like to loop through the names of the hash elements like this:
(summary, not actual code)
foreach element_name (keys %hash)
{
if (param('cycle') = 0)
{
set form element_name value = $hash{$key}{element_name};
}
else
{
set form element_name value = param('element_name');
}
}
Note: I name each form object after the corresponding hash name.
So, can this be done?
Paanwa Guest
-
Get list of all Field Names in ORACLE DB
I'm wondering if there is a way I can list all of the field names in an Oracle table easily? Any ideas? -
DBI::mysql column names as hash keys?
Hello, Given a DBI::mysql database with 2 tables and 5 columns like so: human --> name --> age --> sex dog --> breed --> colour -
creating a hash list from arrays
Hi, As per the code below, I am trying to read from the database and put the values into a hash list, so that I can retrieve the values later. I... -
putting list into value for hash key
I have a hash that contains keys, but does not yet have values. How do you push a list of an item into the value for a particular key? I tried... -
List all and field names database contents
I have been provided with a DSN, user name and password for one of my clients sites. I'm not an ASP developer and need to view all the contents...



Reply With Quote

