# in this example, the user has choices to navigate around some structure. my %dispatch = ( First => \&goto_first, Prev => \&goto_prev, Next => \&goto_next, Last => \&goto_last, ); my @menu = qw( First Prev Next Last ); ksh_select { defined $menu[$_] ? $dispatch{$menu[$_]}->() : warn "Selection out of range!\n"; } @menu;