develooper Front page | perl.beginners | Postings from February 2002

Help with simple menus

Thread Next
Tim Lago
February 27, 2002 12:02
Help with simple menus
Message ID:
I have this perl script that works for what I need to do with it except for
the menus.  I am new to perl and I have found out that I can download menu
modules that can do what I want, but I am looking for a simpler solution.

Ok, the question I have is this, can I create a simple menu that allows for
the user to select from a pre defined section of choices, 1-5, and how would
I do this.  What I have done with the first two choices doesn't work, it
always defaults to the first choice.

Anyway help would be greatly appreciated it.


#This allows the user to choose the Access log of the Real Media Server

print "Enter the name of the Real Media Access Log:\n";
print "\n";

chomp($infile = <STDIN>);

open(INFILE, "$infile") or die "Can't open the Real LOG!: $!";
open(OUTFILE, ">outfile.1") or die "Can't create outfile.txt: $!";

print "Enter name of the Real Media file; \n";
print "\n";

chomp($realname = <STDIN>);

$counter = 0;

while(<INFILE>) {
 if(/$realname/) {
 print OUTFILE;

print "$counter matches \n";

print "\n";

# This section allows the user to choose the type of connection that was
made to the Real Media File

print "Choose the type of connection:\n\n";

print "1- Proxy Server: Site 1, \n\n";

print "2- Proxy Server: Site 2, \n\n";

print "3- Proxy Server: Site 3, \n\n";

print "4- Proxy Server: Site 4, \n\n";

print "5- All Proxy Servers \n\n";

print "6- All Non Proxy Connections \n\n";

chomp($choice = <STDIN>);

open(INFILE, "outfile.1") or die "Can't open input file!: $!";
open(OUTFILE, ">outfile.2") or die "Can't create out put file!: $!";

$count = 0;

if ($choice = 1){
  print OUTFILE;

elsif ($choice = 2){
  if(/ {
  print OUTFILE;

print "$realname was accessed on choice $choice, $count times. \n";

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About