Update: Added -> to ref and fixed typo in title Update 2: To Clarify what I'm trying to do here is to call the sub reference stored in the Procedures hash with the argument $Parameter. This is a simplified case of my real world problem#!/usr/bin/perl use strict; use warnings; sub Procedure_Name_1 { my($Parm) = shift; print($Parm); } my %Procedures; $Procedures{'ProcName1'} = \&Procedure_Name_1; my $Procedure = 'ProcName1'; my $Parameter = 'Some Value'; &$Procedures->{$Procedure}($Parameter);
In reply to How to call a sub ref from a hash by NateTut
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |