in reply to matching input to hash keys

Looks like you are passing an array to name_nums(), but not doing anything with it... try replacing your foreach line in name_nums() with:
foreach(@_) {
I think that should get you pointed in the right direction.... ;-)

-Blake