All pastes #384650 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-07 06:17 UTC
rendered paste body
#!/usr/local/bin/perl
  
my %dispatch = (
one => \&one,
two => \&two,
);
  
print "Enter Choice :";
my $choice = <STDIN>;
chomp($choice);
  
my $sub = $dispatch{$choice};
if (defined($sub)) {
&$sub;
} else {
print "That choice doesnt exist\n";
}
  
  
sub one
{
print "Choice one\n";
}
  
sub two
{
print "Choice two\n";
}