My apologies for the bad title. It's already taken me 30 minutes to come up with that! ;)
I use this a lot: (Very cool IMHO)
@hash{a..z}=(1..26)
What I'd really like to see though is something like this:
$hash{a..c}='some value'
Where the results would be equivalent to:
$hash{a}{b}{c}='some value'
Is there a cleaver way of doing this that would add the items. I had a subroutine (misplaced it) that would reverse the tree 'c'..'a' when passed 'a'..'c', loop on it, build a hash 'c'=>'some value', place that hash in 'b'=>{'c'='somevalue'} and finally 'a'=>{'b'=>{'c'='somevalue'}.
Obviously, if I ran the sub a second time with, (a,b,d)='another value', the 'b' branch (and 'a' for that matter) would be completely over-written. I'm not seeing the solution. Please help! 8)
All help will be greatly appreciated!
Shawn M Ferris
Oracle DBA
In reply to A hash slice but not.. by smferris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |