in reply to Re^6: How to call a sub reff from a hash
in thread How to call a sub ref from a hash
$Parameter is not a hash element it is an argument to the procedure reference stored in the hash.
I know. I didn't use ->{}. I used ->() which calls the referenced sub.
I'm sorry but that doesn't work either
Yes it does.
#!/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);
>perl 730516.pl Some Value
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: How to call a sub reff from a hash
by NateTut (Deacon) on Dec 16, 2008 at 04:49 UTC | |
by ikegami (Patriarch) on Dec 16, 2008 at 04:52 UTC | |
by NateTut (Deacon) on Dec 16, 2008 at 19:12 UTC |