use strict; my $input; my @choice = ( 'Cancel FINAL Schedule for machine A', 'Submit new FINAL schedule', 'Ignore Wrkld', 'Run around the block', 'Buy a new car', 'order Pizza', 'exit', ); while (1) { menu(); chomp ($input = <>); last if $input == 7; print "You have chosen option $input\n"; } sub menu { print "Enter a number for the option you want\n"; print map { ($_+1).": $choice[$_]\n" } (0..$#choice); }