Yes it does work. Once.
Hashes start off empty. But if you put your code into a subroutine and call it twice, the second time around it will still be populated from the first.
Incidentally I'm willing to bet, sight unseen, that the actual code in the cookbook got this right. :-P
Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)