printf "%2d) %s\n", $_, $menu[$_]->{label} for 0 .. $#menu; if ( $input !~ m/\A\d+\z/ || $input > $#menu || $input < 0 ) {