Your code in sub locallb_get_member_v2 { constructs a weird data structure and contains stuff that makes it hard to believe this is meant as such:

$members{ $status->{'address'} = $member->{'port'}};

Are you sure that this code is intended as such? Did you maybe mean the following? Note the placement of curly braces

$members{ $status->{'address'}} = $member->{'port'};

Also, are you using the strict pragma? I can't find where you declare $status, but you use it in the next line:

$members{ $status}->{'enabled'} = $ENABLED_STATUS_MAP->{ $status->{' +enabled_status'} }

If your problem is that you are unclear about where parentheses go when assigning things to hashes, I recommend using intermediate variables to store the elements and use sequences of very simple assigments. What key in %members did you want to assign to? $members{ $status } or $members{ $status->{'enabled'} }?

I recommend restructuring all your hash assignments like the following structure:

# Restructure the following line # $members{ $status}->{'enabled'} = $ENABLED_STATUS_MAP->{ $status-> +{'enabled_status'} } # ... into lines that end up $members{ $key }= $value; my $key= $status; my $value= $ENABLED_STATUS_MAP->{ $status->{'enabled_status'} }; warn "Assigning '$key'='$value' in results"; $members{ $key }= $value;

If you read your code like that, it seems highly unlikely to me that you really meant that. Maybe you meant the following?

# $members{ 'enabled' }= $ENABLED_STATUS_MAP->{ $status->{'enabled_s +tatus'} } # ... into lines that end up $members{ $key }= $value; my $key= 'enabled'; my $value= $ENABLED_STATUS_MAP->{ $status->{'enabled_status'} }; warn "Assigning '$key'='$value' in results"; $members{ $key }= $value;

In reply to Re^3: Complicated datastructre and after merging giving numeric value need help!! by Corion
in thread Complicated datastructre and after merging giving numeric value need help!! by nramya82

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.