for my $component ( @$Tools_Hash ) { my $entity = shift @$component; # first thing is the entity to check. if ( $things_to_check{ $entity } == 1 ) { my $check_function = pop @$component; # last thing is the function to check. my $ret = $check_function->( $entity, @$component ); #rest of the inbetween things are args to function. } }