Essentially, I have a process that puts parties in particular transactional roles and am trying to compare production values to uat values. The data is being improved and re-mapped, and I'm trying to figure out how to quantify this.

At this point, I have a loop over the hashes that will compare values, so it will compare a production transaction for a particular role to the uat transaction for the same role and print it (so I can determine if it's changed, added, or removed). In some cases, however, a party has been remapped to a different role. I'd like to reflect this, so if I find the role defined with a value in production I really want to cycle through all the roles defined for the UAT transaction and check if I see the same value, and then print the value it's moved to.

I'm only trying to do this if the role is undefined in UAT, and honestly I'm not sure this is actually what I will eventually need. Essentially I was asked for "how much data has been changed?" -- for several hundred thousand records, for several fields, in moderately complex transactions. What I have does go partway towards that, but I still think it could be improved.

Anyway, comments appreciated.
print "Transaction ID\tPROD\tUAT Tran ID\tUAT\n"; # $key = transaction ID # $value = detail data of interest #prod hash is just a hash on transaction id (the reference is to a spe +cific role). UAT hash is a HoH of ## $uat{transaction id}{role} while (my ($key, $value) = each(%$prod)) { print "$key\t$value\t"; exists $uat_tid{$key}?print "$uat_tid{$key}\t":print "No UAT trans + id\t"; exists $uat->{$key}{$inrole}?print "$uat->{$key}{$inrole}":for my +$role_key ( keys %{$uat->{$key} } ) { print $role_key if $uat->{$key}{$role_key} eq $value}; ## iterate through UAT hash for transaction id to determine if par +ty has been remapped to a different role # Does the code below work? And if so, can I really insert it th +e way I did into the trinary operator above? # for my $role_key ( keys %{$uat->{$key} } ) # { print $role_key if $uat->{$key}{$role_key} eq $value;} print "\n"; }




-----------------
s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;

In reply to Iterating over second key in HoH defined by reference by SamCG

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.