Loading ...
Sorry, an error occurred while loading the content.
 

foreach'ing a call to a subroutine

Expand Messages
  • Steve Milo
    I ve got a few subroutines in a script I m working on. One particular subroutine calles the other subroutines. This is all being done for a menu. What I m
    Message 1 of 1 , Nov 29, 2000
      I've got a few subroutines in a script I'm working on. One
      particular
      subroutine calles the other subroutines. This is all being done for a
      menu.

      What I'm trying to accomplish is that I put all the names of these
      subroutines that I'm calling into an array. If the user makes the
      choice in the menu that requires calling all the subroutines. This
      particular subroutine has to call all the others.

      @menu("Ihave", "thispart", "figured", "out");

      $input=<STDIN>;


      if ($input >= 0 && $input < @menu) {
      if ($menu[$input] =~ /Ihave/) {
      &suba;
      } elsif ($menu[$input] =~ /thispart/) {
      &subb;
      } elsif ($menu[$input] =~ /figured/) {
      &subc;
      } elsif ($menu[$input] =~ /out/) {
      &subd;

      ####Here is where I'm having trouble
      sub suba {
      @subs=qw(&subb &subc &subd);
      #### dont know how to call each
      ####routine when this choice is made
      ####when the choice is made
      }
      sub subb {
      ($outputfile, @inputfiles)=("$OUTVARB", "$INVARB", "$INVARB");}


      sub subc {
      ($outputfile, @inputfiles)=("$OUTVARC", "$INVARC", "$INVARC");}


      sub subd {
      ($outputfile, @inputfiles)=("$OUTVARD", "$INVARD", "$INVARD");}

      } #End if first if
    Your message has been successfully submitted and would be delivered to recipients shortly.