in reply to Making a Hash of Arrays

You're putting stuff in the anonymous array (potentially) twice:
$hash{$arg} = [@array]; push (@{ $hash{$arg} }, @array) unless /^\#|none|unkno/i;
The first line copies all of the contents of @array and populates an anonymous array with them, sticking it in the hash slot.

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
    I just saw that! I was just getting ready to update my post. When I remove the line:
    $hash{$arg} = [@array];
    things seem better, although printing each key/value seems to print "value" as one continuous string.