#!/usr/local/bin/perl my $letter = "c"; my %h = ( "a" => sub{print "1"}, "b" => sub{print "2"}, "c" => sub{print "3"}, ); $h{$letter}->();