smferris has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A hash slice but not..
by chipmunk (Parson) on Feb 15, 2001 at 00:41 UTC | |
by extremely (Priest) on Feb 15, 2001 at 00:48 UTC | |
by tilly (Archbishop) on Feb 15, 2001 at 00:53 UTC | |
by extremely (Priest) on Feb 15, 2001 at 01:05 UTC | |
by chipmunk (Parson) on Feb 15, 2001 at 00:59 UTC | |
by smferris (Beadle) on Feb 15, 2001 at 01:32 UTC | |
|
Re: A hash slice but not..
by smferris (Beadle) on Feb 15, 2001 at 00:28 UTC | |
by merlyn (Sage) on Feb 15, 2001 at 00:59 UTC | |
by extremely (Priest) on Feb 15, 2001 at 00:40 UTC | |
|
Re: A hash slice but not..
by extremely (Priest) on Feb 15, 2001 at 00:31 UTC | |
by japhy (Canon) on Feb 15, 2001 at 00:34 UTC |