#!/usr/bin/perl use strict; use Data::Dumper; my %hash = map { my $item = pop @$_; map { $_, $item } @$_ } [qw(HELP ?) => sub { print "help\n"; }], [qw(QUIT EXIT LEAVE) => sub { "exit"; }]; &{%hash->{HELP}}(); &{%hash->{'?'}}(); print Dumper(%hash); 1;