Here's my current thinking, but I dont know how to dispatch/execute it
my $key; my @arraydata; my %commandfunc{ "ab 1", \&func1(\@arraydata), "ab 2", \&func2(\@arraydata, "ab 3", \&func3(\@arraydata) }; foreach $k (keys %commandfunc){ if($something =~ /$k/){ #if $something match with a key string $key= $k; #some processing arraydata here; } } #dispatching?? my $command = $commandfunc{$key}->(\@arraydata);
Please correct my code.. Thanks alot