in reply to Data extraction from hash problem

My first piece of advice is "perldoc Test" - a good test harness is an invented wheel.

OTOH that does not solve the problem at hand. And that problem is that the number in the hash has a space in it. The number you are looking up does not.

A stupid way to dump complex data structures is to insert something like this at an appropriate place in your script:

use Data::Dumper; print Dumper(\%PhoneBook);
In this case that will give:
$VAR1 = { ' 9000' => 'Dick ', ' 1234' => 'Harry ', ' 8594' => 'Tom ' };
and you see the space in the number and the return in the name that you probably didn't want.

BTW it is good practice to declare hashes you plan to use as global data with "use vars".

As always, /tell tilly if you have questions about this.