Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But instead my code is creating this, what is wrong?$VAR1 = { 'WaterSports' => [ '8765', [ 'Drysuit', 'r', 'M-L' ] '8365', [ 'Paddle', 't', '45' ] ] };
This is my code:$VAR1 = { 'WaterSports' => [ '8765', [ 'Drysuit', 'r', 'M-L' ] }; $VAR1 = { 'WaterSports'=> [ '8365', [ 'Paddle', 't', '45' ] ] };
Thanks is advance!!open(INFILE, "products-id.txt")|| die "Cannot open products-id.txt fil +e"; open (OUTPUT,">$output") or die ("Can't open file $output $!"); chomp(my @ProductArray = map { /^\s*$/ ? () : $_ } <INFILE>); close (INFILE); foreach my $line(@ProductArray) { my ($Category, $ID, $Name, $Type, $Size) = split( / /, $line ); %AllProducts = ($Category => [$ID, [$Name, $Type, $Size]]); print OUTPUT Dumper(\%AllProducts); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Different hashes?
by Fletch (Bishop) on Mar 26, 2004 at 14:58 UTC | |
by Happy-the-monk (Canon) on Mar 26, 2004 at 15:12 UTC | |
by Fletch (Bishop) on Mar 26, 2004 at 16:19 UTC | |
|
Re: Different hashes?
by tcf22 (Priest) on Mar 26, 2004 at 15:04 UTC | |
|
Re: Different hashes?
by borisz (Canon) on Mar 26, 2004 at 15:07 UTC | |
|
Re: Different hashes?
by Happy-the-monk (Canon) on Mar 26, 2004 at 15:03 UTC | |
|
Re: Different hashes?
by Anonymous Monk on Mar 26, 2004 at 15:36 UTC | |
|
Different hashes part II
by Anonymous Monk on Mar 26, 2004 at 16:29 UTC | |
by Anonymous Monk on Mar 26, 2004 at 16:50 UTC | |
by Anonymous Monk on Mar 26, 2004 at 17:15 UTC | |
by graff (Chancellor) on Mar 26, 2004 at 17:21 UTC |