Scrolling Lists, Multi-Form Pages, Text Display
#!/usr/bin/perl -w

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

print header;
print start_html("User chooses from a mutually exclusive group!");

print start_form(),
      "Get one of the following: ", br,
      radio_group(-name => 'pick_one',
                     -value => ['time', 'listing of current directory', 
                                'name of current directory', 'display file'])
      , p, reset(-name => 'Reset'), submit(-name => 'Submit'), end_form;

($choice) = param('pick_one');
if ($choice eq "display file")
{
     opendir(D, ".") or die "$!";
     @files = sort readdir D;
     print start_form(), "Choose a file: ",
           scrolling_list(-name => 'print_file', -value => \@files, -size => 5),
           p, reset(-name => 'Reset'), submit(-name => 'Submit'), end_form;
     closedir D;
}
           
if (param('pick_one'))
{
     ($choice) = param('pick_one');  #  Parens around $choice NECESSARY!!
     if ($choice eq "time") {print scalar(localtime(time)), "\n"}
     elsif ($choice eq "listing of current directory") 
     {
         opendir(D, ".") or print "Cannot open current directory!\n";
         @files = sort readdir D;
         print  li(\@files);
         closedir D;
     }
     elsif ($choice eq "name of current directory") {print cwd(), "\n"}
}
elsif (param('print_file'))
{   
    ($fchoice) = param('print_file');
    open(F, $fchoice) or die "$!\n";
    @lines = <F>;
    print strong("Listing of $fchoice");
    foreach  (@lines)
    {
         s/&/\&amp;/g;
         s/</\&lt;/g;
         s/>/\&gt;/g;
    }
    print pre(\@lines); 
    close F;
}

print end_html;