SPUG: Trouble using a hash

Curtis Lacy cel1 at ix.netcom.com
Wed Nov 19 19:47:25 CST 2003


Simple question which I hope someone will take the time to answer. I am doing a little Perl script to do some studies of thoroughbred horse racing (what an original idea!).  One thing I need to know is when a previous race was on the same track or on the same track circuit.  [For example, Santa Anita, Hollywood Park, and Del Mar are all considered to be in the Southern California circuit.]

So I have a hash defined and initialized as follows:

my %trackCircuit = ( Hol=>'SoCal', Aqu=>'NYRA' );

just to give a short sample.

There is an array of items, @LR, which describes the last race run by the horse.  The track is in the first spot, $LR[0].

In the debugger, when I try to step through a line which has a term like $trackCircuit{  $LR[0] }, it complains about an uninitialized value.  I get the same squawk if I try to do it from the debugger:

p $trackCircuit{ $LR[0] }

Yet, when I do

p $LR[0]

it gives me the correct string "Hol", and if I try

p $trackCircuit{ "Hol" }

it gives the expected "SoCal".

I am at a loss to know what to try next.

Curtis Lacy
cel1 at ix.netcom.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20031119/0eb23749/attachment.htm


More information about the spug-list mailing list