Prince Mavi wrote:
> Hi folks
> 
> I am new to perl. this is my first real program in perl.
> The program is not doing what i intend it to do.
> The problem in nut shell is that:
> I expect to see the menu first and then input my choice.
> but
> the program asks for my choice first and then displays the menu
> 
> Please have a look and see what am i doing wrong.
> 
> Thanks a ton for your time guys.

Changes that I found to make it work:

#!/usr/bin/perl
use strict;
use warnings;

sub dispBlanks {
print "\n\n";
}

sub clrScr {
        system("clear");
}

sub dispMenu {
#clrScr;          # <-------------- commented out
print "\n\n=== Student Manage Pro ===\n";
print "1. Display all students\n";
print "2. Display a particular student\n";
print "3. Add a new student\n";
print "4. Delete a student\n";
print "0. Exit\n";
print "Please choose one of the options\n";
}

while (1) {
dispMenu(); # <-------------------- missing semi-colon
my $choice = <STDIN>;
chomp($choice);                         # to remove newline
print "you chose $choice";
dispBlanks;
}

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to