You should generally be using subroutine() instead of &subroutine(), i.e. no leading ampersand (&). See perlsub.
Actually, if you read threads::shared, you'll find that his use of &share([]); is exactly the correct thing to do in this case.
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".
| [reply] [d/l] |
| [reply] |
Hi everyone thank you so much for your help....
Thanks for the tutorials... I'm trying to correct my code ...
I've successfully tried sharing array X (when X is a one_dim array)... but I'm still having the hardest time converting this code so that array X is looks like below
X[0] = ("QWE", "RTYU" ,"IOP")
X[1] = ("QSWE", "TYU" ,"IKOP", "BVC")
X[2] = ("QE", "TYU")
X[3] = ("QSWE", "TYU" ,"IKOP", "BVC", "LMNB")
.
.
.
here is the code that works for one_dim array X
my @X : shared = ();
sub abc {
my $Var2;
.... Here the string in $Var2 gets updated everytime abc is called ....
push(@X, $Var2);
}
here is how I'm changing this
my @X : shared = ();
sub abc {
my $Var2;
.... Here the string in $Var2 gets updated everytime abc is called
push(@{X[$i]}, $Var2);
}
I'm still confused, I'm not quite sure how to share the arrays inside of X correctly.
Could you please help me with that?I greatly appreciate all your help.
thank you so much
| [reply] [d/l] [select] |