For the first part, you could think about using the 'exists' Perl keyword, as in :
if (exists($fruit($praticular_product))
{
print "Found Apple in fruit\n";
}
else
{
print "Apple not found in fruit\n"
}
you can use 'for' to iterate (loop through) and then print a Perl hash - see here
Perl Hash[
^]