Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: hash and array mismatch

by Anonymous Monk
on May 09, 2007 at 19:09 UTC ( #614480=note: print w/replies, xml ) Need Help??

in reply to hash and array mismatch

The keys corresponding to 9-13 were repeated later in your $line, which resulted in an overwrite of the values corresponding to those keys.

For example, from the first set of print statements, position 9 corresponds to "POSITION NAME", which would look something like:

$dataPos{"POSITION NAME"} = 9;
A little further in your list you'll see "POSITION NAME" at position fifteen; the assignment statement for this would look something like
$dataPos{"POSITION NAME"} = 15;
Since this statement is executed after the first, your 9 disappears, and only 15 is stored as the value for the key of "POSITION NAME".

Repeat the above for entries 10-13, and you should see those values got overwritten.

If you want to keep all this data, you might consider making the integers your keys, and saving the text as the values. Of course, you already did that when you created the @data array.



Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://614480]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2023-09-30 21:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found