##
# Setup
my %fruit;
++$fruit{$_} for qw( apple banana orange );
# Sample usage
if ($fruit{$object}) {
...
}
####
# Setup
my %dispatch = (
colour => \&area_fill,
scale => \&scale_image,
warp => \&warp_image,
);
# Sample usage
if ($handler = $dispatch{$command}) {
$handler->();
} else {
die("Invalid command $command\n");
}