#!c:/Perl/bin/Perl -wT use strict;#force us to pre-declare variables use CGI qw/:standard/; print header;#header type is text/html #require "c:/progra~1/apache~1/apache/cgi-bin/getmenu.cgi"; #& java; my $value = "Zen"; my $lfilename = "products.pdg"; open (FILE, $lfilename) or &dienice; my @products; while ( ) { if ( /^Begin Product (.*)/i ) { # We have a product starting line my %hash; $hash{ 'prodcode' } = $1; # get the product code. $hash{ 'prodname' } = ; $hash{ 'prodprice' } = ; $hash{ 'prodweight' } = ; my $trackinv = ; $hash{ 'tracking' } = ( $trackinv =~ /(Yes|No)/i ); my $img = ; my($img1,$img2)=split(/\|/, $img); $hash{ 'img1'} = $img1; $hash{ 'img2'} = $img2; $hash{ 'prodtext' } = ; my $line = ; last if ( $line =~ /End Product/ ); if ( $line =~ /^\s*Begin Option (.*)$/ ) { my $name = $1; my @option_list; while ( ) { last if ( /End Option/ ); push @option_list, $_; } $hash{ $name } = \@option_list; } else { #if there is no option, then stick what's in front of the : as the hash name, the rest as it's value my ( $name, $value ) = ( $line =~ /^\s*(.*?):(.*)$/ ); $hash{ $name } = $value; } push @products, \%hash; print ""; print ""; print ""; print ""; print ""; print "
"; foreach my $ref ( @products ) { if ($ref->{prodname} =~ ($value)){ print ""; print $ref->{prodname}; print ""; print "
"; print "{img2}\">"; print "
"; print $ref->{prodprice}; print "
"; print "{prodcode}\">", "Add to Cart", ""; #print $ref->{prodtext}; print "
"; print "
"; }}}} close (FILE); print "
";