sub this { return "this"; # Whatever } sub that { return "that"; # Being simple here } # etc #### my %action = ( this => sub {return "this"}, that => sub {return "that"}, # etc ); # Then later: if (exists $action{$in}) { $action{in}->(); } #### sub ret_simple_returner { my $arg = shift; return ($arg, sub {$arg}); } my %action = map ret_simple_returner($_), qw(this that);