in reply to simple menu loop problems
#!/usr/bin/perl -w use strict; my $read; sub menu { print "1) Cancel FINAL Schedule for machine A\n"; print "2) Submit new FINAL schedule\n"; print "3) Ignore Wrkld\n"; print "4) Run around the block\n"; print "5) Buy a new car\n"; print "6) order Pizza\n"; print "7) exit\n"; } for (;;) { &menu; chomp($read = <STDIN>); exit 0 if $read=~ /7/; print "You have chosen option $read\n"; print "Enter a number for the option you want\n"; }
|
|---|