[dancer-users] Getting Value of nested hash attributes -- HASH confusion
Richard Reina
gatorreina at gmail.com
Mon Aug 31 23:53:51 BST 2015
2015-08-31 17:07 GMT-05:00 Andrew Beverley <andy at andybev.com>:
> On Mon, 2015-08-31 at 16:37 -0500, Richard Reina wrote:
> [...]
> > <td width="550"><% Chlngs.$ID.DESCRIP %></td>
> > <td><input type="text" name="<% Chlngs.$ID.ID %>"
>
> So, the name of the input parameter is an ID number.
>
> > However, after getting the template to work I am once again stumped in
> how
> > to capture the value of the dynamically named hash ref
>
> In which case it will be returned as a scalar using param():
>
> my $value = param( $key );
>
> Which will return, for example, "7", if that is what is in the textbox.
>
> > foreach my $key ( keys %$Chlngs ) {
> > print "Checking Chlgs: " . $key . " for value.\n";
> > if ( param( $key ) ) { # paramter has value
> > #$input_hash->{ $key } = $Chlngs->{ $key };
> > $input_hash->{ $key } = param( $key );
>
> ^^ So just capture the value here, but just in a scalar
> Is there a reason for using a hash?
>
>
No, no good reason to be using a hash. Been hammering so much that I forgot
that everything looks like a nail. Thank you for pointing out that I don't
need a hash here. What a relief.
my $value = param( $key ) is exactly what I needed. Thank you once again.
I will someday need to fly to London and buy you several pints!
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150831/346f344f/attachment.html>
More information about the dancer-users
mailing list