in reply to Re: how to hash this
in thread how to hash this
open (FILE, $lfilename) or &dienice; my $hash; my $line; my %hash; my @products; while ( <FILE> ) { if ( /^Begin Product (.*)/i ) { my %hash; $hash{ 'name' } = $1; $hash{ 'description' } = <FILE>; $hash{ 'numberline1' } = <FILE>; $hash{ 'numberline2' } = <FILE>; my $track = <FILE>; $hash{ 'tracking' } = ( $track =~ /(Yes|No)/i ); $hash{ 'images' } = <FILE>; $hash{ 'producttext' } = <FILE>; my $line = <FILE>; last if ( $line ~= /End Product/ ); ##i'm getting a syntax error o +n this line: line 27, near "$line ~". if i take out the line, i get: + Can't use an undefined value as a HASH reference at c:\PROGRA~1\APA +CHE~1\APACHE\CGI-BIN\GETPRO~2.CGI line 31, <FILE> line 2134. push @products, \%hash; }} print "<B>", my $ref->{name}, "</B>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: how to hash this
by chromatic (Archbishop) on Apr 01, 2001 at 02:01 UTC | |
by malaga (Pilgrim) on Apr 01, 2001 at 02:14 UTC | |
by bbfu (Curate) on Apr 01, 2001 at 07:14 UTC | |
by malaga (Pilgrim) on Apr 01, 2001 at 08:59 UTC | |
by bbfu (Curate) on Apr 01, 2001 at 09:16 UTC | |
|