in reply to Re: Stuck with Creating Multi-Level hash
in thread Stuck with Creating Multi-Level hash
Below is the simple code that builds the multi-hash data structure..
use Data::Dumper; use Tie::Autotie 'Tie::IxHash'; tie my %Menu_Multi_Hash, 'Tie::IxHash'; $Menu_Multi_Hash{'L1A'}{'L2A'} = undef; $Menu_Multi_Hash{'L1A'}{'Second'} = undef; $Menu_Multi_Hash{'L1A'}{'L2A'}{'L3A'} = undef; $Menu_Multi_Hash{'L1A'}{'L2A'}{'L3B'} = undef; $Menu_Multi_Hash{'L1A'}{'L2A'}{'L3A'}{'L4A'} = '/path/to/exe'; $Menu_Multi_Hash{'L1A'}{'L2A'}{'L3A'}{'L3B1'} = '/path/to/exe'; $Menu_Multi_Hash{'L1A'}{'L2A'}{'L3B'}{'L4A'} = '/path/to/exe'; $Menu_Multi_Hash{'L1A'}{'Second'}{'L3B'} = '/path/to/exe'; $Menu_Multi_Hash{'L1A'}{'Second'}{'Third1'} = '/path/to/exe'; print Dumper(\%Menu_Multi_Hash);
The output is as follows:
$VAR1 = { 'L1A' => { 'L2A' => { 'L3A' => { 'L4A' => '/path/to/exe', 'L3B1' => '/path/to/exe' }, 'L3B' => { 'L4A' => '/path/to/exe' } }, 'Second' => { 'L3B' => '/path/to/exe', 'Third1' => '/path/to/exe' } } };
Hence, I was under the impression that if I can achieve this in an efficient way, I will get a multi-hash to use with the CGI:Explorer module.
Please advice if my approach is wrong.
|
|---|