in reply to Data extraction from hash problem
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:
In this case that will give:use Data::Dumper; print Dumper(\%PhoneBook);
and you see the space in the number and the return in the name that you probably didn't want.$VAR1 = { ' 9000' => 'Dick ', ' 1234' => 'Harry ', ' 8594' => 'Tom ' };
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.
|
|---|