in reply to passing hash elements as parameters
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: passing hash elements as parameters
by emilford (Friar) on Oct 09, 2002 at 19:14 UTC | |
by hiseldl (Priest) on Oct 09, 2002 at 20:32 UTC | |
by robartes (Priest) on Oct 09, 2002 at 20:37 UTC | |
|
Re: Re: passing hash elements as parameters
by emilford (Friar) on Oct 09, 2002 at 19:03 UTC |