dana has asked for the wisdom of the Perl Monks concerning the following question:
HI!!
This may be fairly easy but I am not seeing the solution.
I'm parsing and viewing data from a comma delimited file using the following (subset of total program):
The first print within the 'foreach' loop yields (please ignore the '' values -- I'll fix those soon:my @data = split(/,/, $line); foreach my $i ( 0..$#data ) { $dataPos{$data[$i]} = $i; print "$data[$i] -- > $i\n"; } print Dumper ( \%dataPos );
WELL -- > 0
ENTRY ID -- > 1
DISPENSATION ORDER -- > 2
CREATOR -- > 3
CREATION DATE -- > 4
SAMPLE ID -- > 5
DESCRIPTION -- > 6
RUN ID AND DATE -- > 7
TOTAL QUALITY -- > 8
POSITION NAME -- > 9
RESULT -- > 10
QUALITY -- > 11
EDITED -- > 12
-- > 13
TOTAL QUALITY -- > 14
POSITION NAME -- > 15
RESULT -- > 16
QUALITY -- > 17
EDITED -- > 18
-- > 19
-- > 20
while a 'Dumper' print out of the dataPos hash yields:
$VAR1 = {
' TOTAL QUALITY' => 14,
'RESULT' => 16,
'CREATOR' => 3,
' ' => 20,
'TOTAL QUALITY' => 8,
'WELL' => 0,
'SAMPLE ID' => 5,
'DISPENSATION ORDER' => 2,
'POSITION NAME' => 15,
'QUALITY' => 17,
'DESCRIPTION' => 6,
'ENTRY ID' => 1,
'CREATION DATE' => 4,
'EDITED' => 18,
'RUN ID AND DATE' => 7
};
Could someone please tell me what happened to values 9 - 13 in the hash and when these two are not equivalent?
Thank you!!