in reply to problem with subroutine and passing hash
You have asked 15 questions here, and either don't know how to debug and fix your programs, or you're too lazy to do it. That needs to change. Learn it and practise it, it's an essential skill in programming.
As a hint, the warning means that $matching_key is undef. So start to print interesting variables in the code, and compare them to what you would expect them to contain, until you find the root cause of your error.
Data::Dumper can help you with printing your data structures.