Im trying to write a menu driven Perl script and I just cant figure out how to do a "Go Back" or an "Exit" option. Below is the perl code Ive written so far. Any help would be great!"
#!/usr/bin/perl -w use strict; use Term::ANSIColor qw(:constants); print GREEN, "------------------------------------\n", RESET; print YELLOW, " Options \n", RESET; print GREEN, "------------------------------------\n", RESET; print "\n"; print "\n"; print GREEN, "1. Adtran\n", RESET; print GREEN, "2. Alcatel\n", RESET; print GREEN, "3. Calix\n", RESET; print GREEN, "4. Juniper\n", RESET; print RED, "5. Exit\n", RESET; print "\n"; print "\n"; print YELLOW, "Selection : ", RESET; my $selection = <>; chomp ($selection); print "\n"; if ($selection == 1) { print "\n"; print GREEN, "------------------------------------\n", RESET; print YELLOW, " Adtran \n", RESET; print GREEN, "------------------------------------\n", RESET; print "\n"; print "\n"; print GREEN, "1. Adtran 1148V\n", RESET; print GREEN, "2. Adtran 1100F\n", RESET; print YELLOW, "3. Go Back\n", RESET; print RED, "4. Exit\n", RESET; print "\n"; print "\n"; print YELLOW, "Selection : ", RESET; my $select_Adtran = <>; chomp ($select_Adtran); print "\n"; if ($select_Adtran == 1) { print "1148V Options\n"; } if ($select_Adtran == 2) { print "1100F Options\n"; } if ($select_Adtran == 3) { print "Go Back a Screen\n"; } if ($select_Adtran == 4) { print "Exit\n"; } } if ($selection == 2) { } if ($selection == 3) { } if ($selection == 4) { } if ($selection == 5) { }
In reply to New to Perl and need help by Narbawlz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |