in reply to Two questions about hashes

No.

But you maybe able to store your data as:

$a{key1}{key2}{key3}{key4}{"a","b","c","d"} = 1; $a{key1}{key2}{key3}{key4}{"a","b","d","c"} = 1; while (my $mkey = each %{$a{key1}{key2}{key3}{key4}}) { my ($a, $b, $c, $d) = split $;, $mkey; ... }

Replies are listed 'Best First'.
Re^2: Two questions about hashes
by i5513 (Pilgrim) on May 30, 2011 at 22:03 UTC
    Hi,
    These kind of hash are usually autovivification instances, which make hard to build like your proposal.
    But in my next program, I will see if it is possible to change my code style so I can write less code with your tip
    Thank you very much!

      If you are building the data structures yourself, you should be able to build them to make using them easy. Knowing so little about what you are doing, it is difficult to give helpful advice. How are you building your data structures? Where does the data come from and how is it organized? What do you want to do with your data structures once you have them? If you post a working example program, complete with input data and desired output, there are probably many people here who would help you improve it.

        Hi,
        
        I'm basically getting data from two different sources:
        
        apache + tomcat + jboss + ... configuration
        custom apps logs
        
        With configuration I want to create a cmdb where I can link together host where we have apps (typical proxypass + mod_jk + tomcat combo)
        
        And with custom application logs, I want to resume it with stats and maybe with graphs
        
        So typically I have:
        
        $apache{host}{$host}{vhost}{$vhost}{route}{$route}{proxypass}...
        
        or 
        
        $log{date}{$date}{level}{$level}{user}{$user}{module}{$module}{msg}{$msg}
        
        And I always was thinking about what is better if recollect all data in only one way or duplicate the info like:
        
        $apache{route}{$route}{host}{$host}{vhost}{$vhost}...
        
        I think it is better have one unique site where you can after extract what do you want exploring it.
        
        Thank you very much !