use strict; use warnings; my %hash = ( foo => sub {return "foo\n"}, bar => sub {return "bar\n"}, ); print &{$hash{'foo'}};