@array1 = ( "1,Larry Wall" , "2,Douglas Adams"); @array2 = ( "1,Programing Perl,1", "2,The Hitchhikers Guide to the Galaxy,2", "2,Mostly Harmless,2"); foreach (@array1) { ($id,$name) = split( /,/, $_); print "The author is $name"; $no = grep { m/,$id$/ } @array2; print "We have $no books by this Author\n"; }