in reply to Supplementary Google GA question
I think you are going in the whole wrong direction. Coordinated arrays is not a good idea for starters. See if you can follow how/why this works and go from there
use strict; use warnings; my @sets; push @sets,{name=>'Country',api=>'get_country()'}; push @sets,{name=>'State' ,api=>'get_state()'}; push @sets,{name=>'fake' ,api=>'get_fake()'}; my %subs; $subs{'get_country()'}=\&get_country; $subs{'get_state()'} =\&get_state; for my $set (@sets) { my $vname=$set->{name}; my $api =$set->{api}; my $call=$subs{$api}; my $res; if (defined $call) {$res=&$call;} $set->{res}=$res; } use Data::Dumper; print Dumper (\@sets); exit; sub get_country{ return 'USA'; } sub get_state{ return 'FL'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Supplementary Google GA question
by Laurielounge (Acolyte) on Sep 12, 2017 at 03:15 UTC |