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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.