in reply to Getting the Value of a single hash key

That ouput you gave us is enlightening. It suggests that when you are putting the %hash hash together, you are inserting array references instead of the values you are expecting. I suspect that in the code that is inserting the key/value pairs into %hash, you need to dereference the value. If you can't find the error, post the portion of your code that assigns the key/value pairs to %hash and we can help you.

Cheers

  • Comment on Re: Getting the Value of a single hash key

Replies are listed 'Best First'.
Re: Re: Getting the Value of a single hash key
by dogz (Initiate) on May 06, 2003 at 20:05 UTC
    Here is the code:
    my $path; my %hash = (); #created items/objects my $line; while ($line = <CREATEFILE>) { chomp($line); ($src, $key) = split (/=/, $line); push( @{$hash{$key}}, $src); }
      Here is an example of the data. The second file handle does not have unique keys so I can't build a hash to test with it.

      There are two source files:

      #Listings Filehandle <CREATEFILE> Source1=Times Source2=DJNews Source3=Yahoo #Repeat Stocks Filehandle <F> F=Source1 F=Source3 LNUX=Source2 AMZN=Source1 INTL=Source3 INTL=Source1