in reply to Testing for existence of subroutine ref?

The problem is that you're calling exists on a subroutine reference for actions 1 and 2. Why not test for something else, such as a HASH reference or a CODE reference using ref? What about:

sub get_config_item { my( $runmodes, $action ) = @_; my $config_item = $runmodes->{ config_item }; if( ref $runmodes->{ $action } eq 'HASH' ) { # error line &{ $runmodes->{ $action }{ subroutine }}; $config_item = $runmodes->{ $action }{ config_item }; } else { &{ $runmodes->{ $action }} } return $config_item; }

Honestly though, this looks to me like a candidate for refactoring, as the contortions that you're now enduring will only get worse as the code expands over time.


"The dead do not recognize context" -- Kai, Lexx