$hash{$d}{$i}=$line[$i];
At this point in the code, $d is a fruit, $i is an index (a number), and $line[$i] is a color (AFAIU your code). Why would you want to associate a number with a fruit and a color with a number (perhaps better expressed as) a fruit with a number and a number with a color? Please take a look at Re^3: hash of hashes.
Also, try using Data::Dumper or Data::Dump (my favorite) for looking at data structures — much more convenient.
And again, please take a look at perldsc.
In reply to Re^3: hash of hashes
by AnomalousMonk
in thread hash of hashes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |