Re: [MacPerl-WebCGI] well split!!!
[email protected] (Bruce Van Allen) Tue, 6 Mar 2001 18:22:36 -0800
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <p05010400b6cb4a48aaea@[205.179.215.44]> |
At 8:03 PM -0500 3/6/01, [email protected] wrote: >>Why not: >> >>($dbID, $cat, $varName, $price, $desc, $itemNum) = split(/\t/); >>Then you can manipulate at will, variable by variable and print >>individually or grouped/reordered. >> >>--Shelly >> > >--Shelly: > >I tried the statement you suggest and had the exact same results as >I indicated in my last post. While I can get the variables to print >(as you indicate), I can't get the same variables to express >themselves in a table. > >For example, the following works for printing: > > open(DATA,$datafile) || &open_error($datafile); > while (<DATA>) > { > for (split(/\t/)) > { > (; > > print "$database_id\n"; > print "$category \n"; Tedd -- Lose the "for (split(/\t/))" part :-) open(DATA,$datafile) || &open_error($datafile); while (<DATA>) { next if /^$/; my ($database_id, $category, $variable_name, $price, $description, $item_number) = split(/\t/); print "<TR>"; print "<TD>$variable_name</TD>"; print "<TD>\$$price</TD>"; print "<TD>$description</TD>"; print "</TR>"; } (or better: print <<ROW; <TR> <TD>$variable_name</TD> <TD>\$$price</TD> <TD>$description</TD> </TR> ROW HTH 1; -- - Bruce __bruce_van_allen__santa_cruz_ca__