I just started trying complex structures in Perl, and Bi-Dimensional arrays and hashes.
I was making this form processor, and to be able to allow my co-workers (who have little idea about perl) to add form fields in the program without worrying about updating their use later in the program, so I hacked this piece of code:
In order to use later in the program%fields = ('1.Name' => $cgi->param('name') || 'Anonymous', '2.Email' => $cgi->param('email') || 'No email Supplied', '3.Comments' => $cgi->param('comments') || 'No Comments', '4.Satisfied' => $cgi->param('radio1') || 'Not Specified', );
foreach (sort keys %names) { print "$_ : $names{$_} \n"; }
Why would using the %fields hash in a hash context
Is this always the way with hashes and references?? ( I might not be using the proper namings here ), or maybe it's the way I'm dereferencing the variable later??
Finally the code worked, but I need to get a grip of what happened, cuz I fixed it by mistake
Thanx
In reply to Hashes and Refs by Chady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |