in reply to Setting a multi-dimensional hash value
#!/usr/bin/perl use warnings; use strict; use Data::Diver qw{ DiveVal }; use Data::Dumper; my %h; DiveVal(\%h, 'shock') = 'jock'; DiveVal(\%h, qw( a b c )) = 42; DiveVal(\%h, qw( x y z )) = 69; DiveVal(\%h, qw( abc def ghi jkl xyz )) = 'value'; print Dumper \%h;
Note that the result differs slightly from your solution: 42 and 69 are stored as numbers, not strings.
|
|---|