Using Frame-Based Layout Control
#!/usr/bin/perl -w

use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);

print header, start_html;

if (!param)
{
print start_form(-target => "foodgroup"),
      p("Pick Favorite Foodgroup"),
      popup_menu(-name => "foodgroup", -values => ["meat", "dairy", "veggie",
                                                   "starch"]),
      submit(-name => "Submit"),
      end_form;
}


if (param("Submit"))
{
      $foodgroup = param("foodgroup");
      print start_form(-target => "foodgroup");
      if ($foodgroup eq "meat")
      {
          print p("Pick your favorite meat");
          print popup_menu(-name => "meat", -values => ["beef", "lamb", "pork",
                                                        "chicken", "fish"]);
      }
      elsif ($foodgroup eq "dairy")
      {
          print p("Pick your favorite dairy food");
          print popup_menu(-name => "dairy", -values => ["milk", "ice cream",
                                                         "cheese", "yogurt"]);
      }
      elsif ($foodgroup eq "veggie")
      {
          print p("Pick your favorite veggie");
          print popup_menu(-name => "veggie", -values => ["peas", "squash",
                      "broccoli", "carrots", "brussel sprouts", "green beans"]),
      }
      else  # starch
      {
          print p("Pick your favorite starch");
          print popup_menu(-name => "starch", -values => ["corn", "rice",
                                            "potato", "oats", "bread"]);
      }

      print submit(-name => "Submit Favorites"),
            end_form;
}


if (param("Submit Favorites"))
{
      $favorites = param("meat"). " ". param("dairy"). " ". param("veggie").
                " ". param("starch");
      print p("Your favorite food is: $favorites\n");
}
      
print end_html;