in reply to Re^2: Attempting to fill a hash
in thread Attempting to fill a hash

I would add:
use Data::Dumper; print Dumper(\%hashlist);
to see what %hashlist contains. That will probably clarify a lot of things.

Replies are listed 'Best First'.
Re^4: Attempting to fill a hash
by TwistedTransistor (Novice) on Jun 06, 2008 at 01:09 UTC
    Added that plug in and ran the code. (I used a majorly slimmed down version of the text file for this example.) Here are the results This is what is in the text file in order:
    a aah aahed aahing aahs aardvark aardvarks aardwolf ab This is what Dump returned $VAR1 = { ' => 1, 'a ' => 1, 'aahed ' => 1, 'aahs ' => 1, 'aardwolf ' => 1, 'aahing ' => 1, 'aardvark ' => 1, 'aardvarks ' => 1, 'ab ' => 1 'aah };
    I notice both the vales and the keys are there, however when i do. print "$hashlist{a}\n"; it returns null followed by a \n. they are also out of order, but for the use I have in mind that is unimportant as long as they all read.
      they are also out of order
      As expected, according to the documentation (perldata):
      Note that just because a hash is initialized in that order doesn't mea +n that it comes out in that order. See sort for examples of how to ar +range for an output ordering.