in reply to Re: From arrayref to hashref
in thread From arrayref to hashref
Actually, it is not stupid -- you can use overload to make that kind of thing work (even without using bless(), I think, though I should have to tinker with it some).
However, if you don't need to optimize for speed, and don't feel like tinkering with overload, there is always good old TIMTOWTDI:
$food = \@array; print +{@$food}->{Corn}; # yay! print @{{@$food}}{Corn,Bannana}; # slice!
Have the appropriate amount of fun with it :-)
Update: Found a better CPAN search link.
The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: From arrayref to hashref
by erikharrison (Deacon) on Mar 21, 2002 at 19:08 UTC |