in reply to using references as keys in a hash.
What are examples of using references as hash keys to make problems easier?
My example, if I wanted to keep a hash of my usernames for websites, and put the prepared HTTP request in the hash.
use Tie::RefHash; use HTTP::Request; use Data::Dumper; $r1 = HTTP::Request->new(GET => 'http://www.perlmonks.org/'); $r2 = HTTP::Request->new(GET => 'http://use.perl.org/'); # Etc... tie %sites, 'Tie::RefHash', ($r1, 'Solo', $r2, 'Solo'); print Dumper(\%sites);
It seems too trivial, but that's probably just my lack of vision ;)
--Solo
--
I think my eyes are getting better. Instead of a big dark blur, I see a big light blur.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why use references as keys in a hash?
by steves (Curate) on Feb 23, 2003 at 15:21 UTC |