You have to dereference the array ref and then you will have access to your 'args.' Look at get_events for an example how to dereference.
#!perl -w use Data::Dumper; $action = 'setup'; $filelocation = '.'; %formdata = ( 'one' => 123, 'two' => 234, ); my %functions = ( "setup" => { function => \&get_events, args => [\%formdata, $filelocation] }, ); $functions{ $action }->{function}-> ( $functions{ $action }->{args} ); sub get_events { my $ref = shift; my $hashref = $ref->[0]; # get \%formdata my $fileloc = $ref->[1]; # get $filelocation print "F:$fileloc\n"; print Dumper( $hashref ); print $hashref->{one},$/,$hashref->{two},$/; }
--
hiseldl
What time is it? It's Camel Time!
In reply to Re: passing hash elements as parameters
by hiseldl
in thread passing hash elements as parameters
by emilford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |