jrsmith has asked for the wisdom of the Perl Monks concerning the following question:
now the problem lies in the foreach loops, i keep getting the error "Can't use subscript on private hash" and i don't know why... as weird as it may sound prior to applying use strict and -w i had array symbols preceding themsub processhtml { my ($file) = $_[0]; my ($filename, $i, $value2, $value3); my (@input, @values); ... substitution and pattern match stuff ... @values = split(" ", $i); if ($values[2] !~ /^[a-z]{1,2}$/i) { $values[2] = ""; } else { } if ($values[0] !~ /000/) { $import_values{"ship"} = $file; $import_values{"weight"} = $values[0]; $import_values{"dwg"} = $values[1]; $import_values{"rev"} = $values[2]; foreach $value2 (keys %import_values{"ship","weight","dwg","rev +"}) { print TEMP ("\"$value2\","); } print TEMP ("\n"); } else { $import_values{"ship"} = $file; $import_values{"weight"} = ""; $import_values{"dwg"} = $values[1]; $import_values{"rev"} = $values[2]; foreach $value3 (keys %import_values{"ship","weight","dwg","rev +"}) { print TEMP ("\"$value3\","); } print TEMP ("\n"); } }
and it worked, but now this problem is driving me up the wall... can anyone shed any light on this for me?foreach $value3 (keys @import_values{"ship","weight","dwg","rev +"}) { print TEMP ("\"$value3\","); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: hashes
by nuance (Hermit) on May 31, 2000 at 22:02 UTC | |
|
RE: hashes
by neshura (Chaplain) on May 31, 2000 at 21:55 UTC | |
by jrsmith (Pilgrim) on May 31, 2000 at 21:58 UTC | |
by KM (Priest) on May 31, 2000 at 22:02 UTC | |
|
Re: hashes
by swiftone (Curate) on May 31, 2000 at 22:02 UTC | |
|
Re: hashes
by jrsmith (Pilgrim) on May 31, 2000 at 22:03 UTC | |
by ZZamboni (Curate) on May 31, 2000 at 22:07 UTC | |
by jrsmith (Pilgrim) on May 31, 2000 at 22:11 UTC | |
by nuance (Hermit) on May 31, 2000 at 22:09 UTC | |
|
Re: hashes
by cwest (Friar) on May 31, 2000 at 23:37 UTC | |
|
Re: hashes
by KM (Priest) on May 31, 2000 at 21:59 UTC |