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 );
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!!
In reply to hash and array mismatch by dana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |