Hi I'm trying to share an array of arrays between threads and I have no luck with that.
I'm new to Perl, I would really appreciate all your help
here is how I'm sharing array X


my $ARRAY_SIZE = 45;
my $X = &make_shared_array();

sub make_shared_array {
my $a = &share([]);
for (my $i = 0;$i < $ARRAY_SIZE;++$i) {
my $row = &share([]);
$a->[$i] = $row;
}
return $a;
}

sub abc {
push(@{$X[$var1]}, $Var2);
}


Basically, new string in (Var2) will be pushed into array X every time this sub gets called.
After we are done writing array X, I would like to be able to compare each of these arays X[0], X[1], X[2], .... Against a one_dim array "Y"
but before I even get to compare the arrays I tried to print X[1] and it's blank :(
I'm not sure what I'm missing.
Thank you so so much for your help


sub test{
Print "@X[1]\n";
}

This is what I'm hoping to print:


X[0] = ("QWE", "RTYU" ,"IOP")
X[1] = ("QSWE", "TYU" ,"IKOP", "BVC")
X[2] = ("QE", "TYU")
X[3] = ("QSWE", "TYU" ,"IKOP", "BVC", "LMNB")
.
.
.

In reply to sharing array of arrays between threads by bebe

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.