my $debug = 5; print STDERR "Looking for id $courowid \n" if $debug > 8; while () { chomp; my ($id, $course) = split(/\t/); print STDERR "trying id $id, course $course\n" if $debug > 8; if ( $id == $courowid ) { print STDERR "found id $id, course $course\n" if $debug > 5; # if we match the ID, push the course name onto the # the array in the coudata hash, key $id push @{$coudata{$id}}, $course; } } print header; if ( %coudata ) { # found, display data by taking each course back outof # the array foreach my $id ( keys %coudata ) { print STDERR "show id $id\n" if $debug > 6; foreach my $course ( @{$coudata{$id}} ) { print STDERR "show id $id, course $course\n" if $debug > 8; print ul("$id: $course"); } # foreach my course } # foreach my id }else { # not found, show error print h1("Can't find row '$courowid'"); }