open FILE , "/courses.txt" or die "Cannot open: $!"; my $couvalue = param('name'); my $courowid = $ARGV[0] || $couvalue; my %coudata = (); my @coufields = split(/\t/, ); chomp @coufields; while() { chomp; my @courow = split(/\t/); if ($courow[0] eq $courowid) { @coudata{@coufields} = @courow; last; } } close (FILE); print header; if ( keys %coudata ) { # found, display data print ul( map { li("$_: $coudata{$_}") } keys %coudata); } else { # not found, show error print h1("Can't find row '$courowid'"); } #######this is what the table looks like: 1414 "Nutitional Epidemiology" 1414 "Nutritional assessment" 1414 "Undernutrition in the United States" 1371 "Health Politics and Policy" 1371 "Advanced Health Politics?" 1371 "Introduction to Health Policy & Management" 1371 "Health and Public Policy Seminar"