Your last quest is how you must write quests with checkhandin now. (except there my be an extra } at its end, check that if it does not work).
If you don't want the NPC to say that he returns items, you must test that there's still some items left in the %itemcount hashtable.
Code:
if (scalar(%itemcount)>0) {
quest::say("Take this back");
plugin::return_items(\%itemcount);
}
Another way is to say nothing and just add return_items.
To test that a string isn't something, use 'ne' and != for an integer
Code:
if ($class ne "Paladin") { }
if ($level != 5) { }
These is the basic perl syntax, there's many tutorials on the web...