With
"1" => \&get_ifc_name,
the hash value is a reference to the subroutine get_ifc_name, but with
"1" => \&get_ifc_name({'ifc_default' => 'test_me',}),
the hash value is a reference to whatever that subroutine returns when called with the specified argument. Even if the subroutine returns a reference to a subroutine, it will be inconsistent with the previous case.
Maybe, instead of a single value for each element of the %menu_hash hash, you should have a reference to a hash, something like:
"1" => { sub => \&get_ifc_name, args => {'ifc_default' => 'test_me',} +},
Later, you can call this with
$menu_hash{1}{sub}->($menu_hash{1}{args});
In reply to Re: Subroutine references inside of a hash with arguments.
by ig
in thread Subroutine references inside of a hash with arguments.
by shift9999
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |