Just as Rata
mentioned, a hash is more logical a solution in this case, a very simple hash approach can perform the job quite efficiently...
how do i compare the array data?...
Using a hash you don't have to compare data because all you need is just a hash key to hold all the data that belong to that type of fruit...
my ($key, $number)=split;
print Dumper (\%hash);
Excellence is an Endeavor of Persistence.
A Year-Old Monk :D .