in reply to Making a Hash of Arrays
The first line copies all of the contents of @array and populates an anonymous array with them, sticking it in the hash slot.$hash{$arg} = [@array]; push (@{ $hash{$arg} }, @array) unless /^\#|none|unkno/i;
The second pushes all of the elements of @array onto the anonymous array, unless your regex matches. (Which it probably won't.)
I'd do something like:
while (<FILE>) { next if /^#/; next if /none|unkno/i; chomp; # print "$_\n"; returns expected results my @array = split; # printing each array element also passes here $hash{$arg} = [@array]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Making a Hash of Arrays
by Limo (Scribe) on Sep 22, 2000 at 23:00 UTC |