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

[email protected] (Bruce Van Allen) Wed, 7 Mar 2001 09:57:00 -0800
Newsgroups perl.macperl.webcgi
Message-ID <p05010402b6cc2606b524@[205.179.215.44]>
Let me just refine that last one a wee bit more:


# Script includes everything to and including the __END__ line:
# Set your #! line as you usually do

#perl -w

use strict;

my $datafile = 'data.txt'; # use your filename

open DATA, "$datafile" or die "Can't open $datafile: $!";
   while (<DATA>) {
     next if /^$/;  # skip empty lines
     chomp;         # remove the "line ending"
     my ($database_id, $category, $variable_name, $price, 
$description, $item_number) = split(/\t/);

     print <<ROW;
     <TR>
       <TD>$database_id</TD>
       <TD>$category</TD>
       <TD>$variable_name</TD>
       <TD>\$$price</TD>
       <TD>$description</TD>
       <TD>$item_number</TD>
     </TR>
ROW

}

close DATA;

__END__


HTH

1;

-- 

   - Bruce

__bruce_van_allen__santa_cruz_ca__