There are many anomalies in your OP code.

For example, you have many blocks of code like this:

unless (exists $$dataref{$eid}{"ALL"}{"MatchesPeopleEn +ded"}){ my %a :shared; $$dataref{$sid}{"ALL"}{"MatchesEnded"}=\%a; }

Note that you are testing exists $$dataref{$eid}{"ALL"}{"MatchesPeopleEnded"})

But are assigning to $$dataref{$sid}{"ALL"}{"MatchesEnded"}=\%a;

That probably explains your immediate problem. However, there are further anomalies.

For example, why are you assigning references to shared hashes to a bunch of variables that you subsequently are using as integers:

$$dataref{$sid}{"ALL"}{"MatchesStarted"}++; $$dataref{$sid}{"ALL"}{"MatchesPeopleStarted"} += $tn; $$dataref{$sid}{$whichco}{"MatchesPeopleStarted"} += $tn; $$dataref{$sid}{$whichco}{"MatchesStarted"}++; $$dataref{$eid}{"ALL"}{"MatchesEnded"}++; $$dataref{$eid}{"ALL"}{"MatchesPeopleEnded"} += $tn; $$dataref{$eid}{$whichco}{"MatchesPeopleEnded"} += $tn; $$dataref{$eid}{$whichco}{"MatchesEnded"}++;

Part of your problem is that you spread your code around all over the place which means that you need to scroll up down many pages to see where a variable is declared, initialised and then used.

There is a huge chunk of code in the middle of your program that I suspect could be replace by this:

$$dataref{$sid} //= &shared({}); $$dataref{$sid}{"ALL"} //= &shared({}); $$dataref{$sid}{"ALL"}{"MatchesStarted"}++; $$dataref{$sid}{"ALL"}{"MatchesPeopleStarted"} += +$tn; $$dataref{$sid}{$whichco} //= &shared({}); $$dataref{$sid}{$whichco}{"MatchesPeopleStarted"} ++= $tn; $$dataref{$sid}{$whichco}{"MatchesStarted"}++; $$dataref{$eid} //= &shared({}); $$dataref{$eid}{"ALL"} //= &shared({}); $$dataref{$eid}{"ALL"}{"MatchesEnded"}++; $$dataref{$eid}{"ALL"}{"MatchesPeopleEnded"} += $t +n; $$dataref{$eid}{$whichco} //= &shared({}); $$dataref{$eid}{$whichco}{"MatchesPeopleEnded"} += + $tn; $$dataref{$eid}{$whichco}{"MatchesEnded"}++;

Which might improve things a little, but I have no way to test that.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

In reply to Re^5: Threads::Shared MultiLevel Hash and the Invalid value for Shared Scalar Error by BrowserUk
in thread Threads::Shared MultiLevel Hash and the Invalid value for Shared Scalar Error by DFass

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.