grouping hashrefs to trees

Discussion in 'Perl Misc' started by Matija Papec, Nov 16, 2003.

  1. Matija Papec

    Matija Papec Guest

    I need to group hashrefs into branches where every instance in branch has
    something in common with others. The problem is that no one can tell which
    attribute will be dominant, so I guess there should be some counting before
    actual grouping into branches. Please tell me that somebody already has
    invented the wheel. :)


    my @rules = (
    {
    'source-port' => 23,
    protocol => "tcp",
    },
    {
    source => '6.11.6.6/24',
    },
    {
    protocol => 'udp', 'source-port' => 53,
    source => '64.11.6.6',
    },
    {
    protocol => 'udp', 'source-port' => 53,
    source => '164.11.6.6',
    },
    {
    protocol => 'udp', 'source-port' => 53,
    source => '164.11.6.7',
    },
    {
    protocol => 'udp', 'source-port' => 53,
    source => '164.11.6.8',
    },
    );


    --
    Matija
    Matija Papec, Nov 16, 2003
    #1
    1. Advertising

  2. Matija Papec

    Ben Morrow Guest

    Matija Papec <> wrote:
    > I need to group hashrefs into branches where every instance in branch has
    > something in common with others. The problem is that no one can tell which
    > attribute will be dominant, so I guess there should be some counting before
    > actual grouping into branches. Please tell me that somebody already has
    > invented the wheel. :)


    You may find Data::Favorites helpful.

    Ben

    --
    For the last month, a large number of PSNs in the Arpa[Inter-]net have been
    reporting symptoms of congestion ... These reports have been accompanied by an
    increasing number of user complaints ... As of June,... the Arpanet contained
    47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
    Ben Morrow, Nov 16, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pif

    Trees in java

    Pif, Apr 6, 2004, in forum: Java
    Replies:
    1
    Views:
    428
    Manolo
    Apr 6, 2004
  2. jacob navia

    Binary search trees (AVL trees)

    jacob navia, Jan 3, 2010, in forum: C Programming
    Replies:
    34
    Views:
    1,390
    Dann Corbit
    Jan 8, 2010
  3. monkeys paw

    array of hashrefs (nested)

    monkeys paw, Oct 27, 2003, in forum: Perl Misc
    Replies:
    9
    Views:
    163
    Bob Walton
    Oct 28, 2003
  4. Sam
    Replies:
    6
    Views:
    154
    Anno Siegel
    Jun 15, 2005
  5. John W. Krahn

    sorting an array of hashrefs

    John W. Krahn, Aug 29, 2006, in forum: Perl Misc
    Replies:
    1
    Views:
    82
    monkeys paw
    Aug 29, 2006
Loading...

Share This Page