Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Minimize Hash Key Value Combinations

by LanX (Saint)
on Nov 18, 2013 at 13:58 UTC ( [id://1063091]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Minimize Hash Key Value Combinations
in thread Minimize Hash Key Value Combinations

"if you take a closer look" to what you said:

> the result should look like this:¹

[a, b, c, d] => [1, 2] [b, c] => [2]

which doesn't make sense, don't you agree?

You are talking about a "hashtree" but the data shown has nothing to do with HoH.

The data shown isn't even valid Perl, keys are strings never arrays.

have a look at How (Not) To Ask A Question

Asking a good question is often the best answer! :)

Cheers Rolf

( addicted to the Perl Programming Language)

¹) OP updated now...

Replies are listed 'Best First'.
Re^4: Minimize Hash Key Value Combinations
by AlexTape (Monk) on Nov 18, 2013 at 14:20 UTC
    first you are right.. i made the result manually.. that was a simple mistake.. :)

    actually it is an hash tree.. but i dont want to deflect the problem with code snippets..
    keys are strings never arrays
    i dont agree.. just take a look at Hash::Multikey or perldsc or maybe it is a nested structure like this:
    #!/usr/bin/perl -w use strict; use warnings; my %hash; $hash{'number'}{'even'} = [24, 44, 38, 36]; $hash{'number'}{'odd'} = [23, 43, 37, 35]; foreach my $i(keys %hash){ print $i; foreach my $j(keys %{$hash{$i}}){ print "\t".$j."\t"; print join(" ",@{$hash{'number'}{$j}})."\n"; } }
    furthermore thats offtopic :)
    $perlig =~ s/pec/cep/g if 'errors expected';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1063091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found