Re: [MacPerl-WebCGI] well split!!!

[email protected] Tue, 6 Mar 2001 20:03:32 -0500
Newsgroups perl.macperl.webcgi
Message-ID <p05010401b6cb37138a2f@[64.194.142.225]>
>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/))
			{
			($database_id, $category, $variable_name, 
$price, $description, $item_number) = split(/\t/);

			print "$database_id\n";
			print "$category \n";
			print "$variable_name \n";
			print "$price \n";
			print "$description \n";
			print "$item_number \n";
			print "<p></p>\n";
			}
		}

However, the following doesn't work for a table:

	open(DATA,$datafile) || &open_error($datafile);
	while (<DATA>)
		{
		for (split(/\t/))
			{
			($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>";
			}
		}

Any idea why?

It's got me bummed.

tedd
-- 
http://sperling.com/