use constant RTN_EXIT => 0; use constant RTN_CONTINUE => 1; use constant RTN_ERROR => 2; # ActionSubs hash ommitted for brevity.. (it contains over 40 entries) %ActionSubsM = ( 'emailagenda' => \&emailagenda, 'defaultagenda' => \&defaultagenda, 'createnewdefaultagenda' => \&createnewdefaultagenda, 'deleteagenda' => \&deleteagenda ); # Parsing code ommitted for brevity... (loads %FORM hash) if (%FORM) { #Are there any entries in the %FORM hash from the parser? $FormCmd=$FORM{'action'} # Determine if the relevant commands are listed in any of the dispatch hash tables, and if so, run the referenced subroutine with the appropriate arguments.... $CmdFound=-1; $RtnVal=RTN_EXIT; #By default, all commands exit if (exists $ActionSubs{ $FormCmd } ) { #Found in %ActionSubs hash? $CmdFound = 1; #Run the subroutine from %ActionSubs corresponding to string argument in $FORM{'action'}... $ActionSubs{ $FormCmd }->(); #HOW TO RETURN A VALUE HERE??? DOES NOT WORK! unless ( $RtnVal == RTN_CONTINUE ) { exit; } } elsif ( ( exists $ActionSubsM{ $FormCmd } ) && $FORM{'meetingid'}) { #Found in %ActionSubsM hash? $CmdFound = 1; #Run the subroutine from %ActionSubsE corresponding to string argument in $FORM{'action'} with argument supplied by $FORM{'meetingid'}... $ActionSubsM{ $FormCmd }->( $FORM{'meetingid'} ); #HOW TO RETURN A VALUE HERE??? DOES NOT WORK! unless ( $RtnVal == RTN_CONTINUE ) { exit; } } # etc. 2 other hash dispatch tables looked at. }