So ... I am lost the forest of braces and brackets...

Then for goodness sake, use some horizontal whitespace!. Ie. spaces.

The only place you've used any is between the function name join, and its open paren where is is completely useless as the paren forms a natural delimiter!

The same snippet with some added makes it easy to see the problems:

sub reportWA{ # $key my $key = shift; my $NewWA; unshift @{ WA{ $key }{ stags } }, $WA{$key}{PT}; unshift @{ $WA{ $key }{ stags } }, $WA{$key}{PT}; $NewWA = $WA{ $key }{ PT }; $#{ @{ WA{ $key }{ stags } } } = $rnds-1; for my $i ( 1 .. $rnds -1 ){ ${ WA{ $key }{ stags } }[ $i ] *= $wght; $NewWA += ${ WA{ $key }{ stags } }[ $i ]; } #plog sprintf "stages = %s" ,join (", ",@stags); $NewWA /= $rnds; printf " %d %d %8.2f %s\n" , $key, $WA{ $key }{ PE }, $NewWA, join( ", ", @{ WA{ $key }{ stags } } ); }

The same with the errors highlighted:

sub reportWA{ # $key my $key = shift; my $NewWA; unshift @{ $WA{ $key }{ stags } }, $WA{$key}{PT}; #............^ $NewWA = $WA{ $key }{ PT }; $#{ @{ WA{ $key }{ stags } } } = $rnds-1; #........^ ......missing $ for my $i (1..$rnds-1){ ${ WA{ $key }{ stags } }[ $i ] *= $wght; #......^...missing $ $NewWA += ${ WA{ $key }{ stags } }[ $i ]; #................^..........missing $ } #plog sprintf "stages = %s" ,join (", ",@stags); $NewWA /= $rnds; printf " %d %d %8.2f %s\n" , $key, $WA{ $key }{ PE }, $NewWA, join( ", ", @{ WA{ $key }{ stags } } ); #.............................^......missing $ }

There may be more errors, but once you fixed those, there'll be less noise from the compiler that should allow you to see what's going on.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Referencing an array in a complex hashed data structure by BrowserUk
in thread Referencing an array in a complex hashed data structure by Wiggins

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.