http://qs321.pair.com?node_id=55624


in reply to push

i posted this question for tilly but i should have posted it here so everyone can see it. please excuse the duplication
i have been trying to tweak this script to cover one more aspect of what i am doing - i need to search for all rows that have a particular id, not just the first one. here's where the script is:
open FILE , "/courses.txt" or die "Cannot open: $!"; my $couvalue = param('name'); my $courowid = $ARGV[0] || $couvalue; my %coudata = (); my @coufields = split(/\t/, <FILE>); chomp @coufields; while(<FILE>) { 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"
i only get one row back.
i've tried taking out "last;"
i've tried to do a foreach instead of an if, but i can't get it to work. i've even posted another sopw, in trying to use "push" to get all the lines that match into one array. can this script work for this problem, and if so, where should changes be made?

thank you for your help.
malaga