in reply to Re: struggling with sub-routines
in thread struggling with sub-routines

The aims of this program are to catergorise the input file with regular expressions, then the user can select from the menu which catergory to look at ; eg
1. choice1 2. choice2
etc. i want the program to go back to the main menu after a choice has been made and the results are displayed.

Replies are listed 'Best First'.
Re: Re: Re: struggling with sub-routines
by r0b (Pilgrim) on Jun 19, 2002 at 16:34 UTC
    To loop the menu i would suggest using the following:
    while(1) { print "\nPlease select the catergory of results that you wish to s +ee;\n\n\t1. first \n\t2. second \n\t3. third \n\t4. forth \n\t5. Othe +rs etc\n\t6. Exit program\n\n"; chomp($choice = <STDIN>); if ($choice eq '6') { last; } #your code here }
    As for the rest of the program I am still unsure as to what the files your are parsing will be like. Could you give an example file?

    ~~rob
    ____________________________________________________________
    eval pack "h*", "072796e647022245d445f475454494c5e622b3";

      An example of the file is something like this:
      1269 /:tremblnew|AAL98468|AAL98468 344 873 6e-94 534 76 +7 166/177 93% 172/177 96% 767 533 3 590 766 1269 /:sptrembl|Q9F445|Q9F445 331 840 5e-90 534 72 +2 162/177 91% 169/177 94% 722 533 3 545 721 1269 /:tremblnew|AAK99986|AAK99986 143 357 2e-33 534 21 +3 72/165 43% 108/165 64% 213 533 39 46 209
      where the reg ex's would be something like;
      if (defined(($array[1] =~ m{/:sptrembl\|\w+\|\w+}) || ($array[1] =~ m{ +/:tre mblnew\|\w+\|\w+})) && ($array[8] > 95))
      thanks, i appreciate your help!