in reply to Return value from code reference stored in dispatch table

You haven't shown us enough to demonstrate the problem.

use strict; use warnings; # $RtnVal = $ActionSubsM{$FormCmd}->( $FORM{'meetingid'} ); my %ActionSubsM; my $FormCmd = "some_action"; my %FORM; $FORM{meetingid} = "Hello world!\n"; $ActionSubsM{$FormCmd} = sub { return shift; }; my $RtnVal = $ActionSubsM{$FormCmd}->( $FORM{'meetingid'} ); print $RtnVal;

...outputs...

Hello world!

The code you are demonstrating is correct if the code you haven't demonstrated provides the necessary setup.

The best thing you could do is boil your problem down to a 10 to 20 line example that can be executed, and that will exhibit the problem you're facing. There's a strong chance that in doing so, you'll find the problem yourself anyway. And if not, you will have something you can post for us to look at. ;)


Dave

Replies are listed 'Best First'.