Link to home
Start Free TrialLog in
Avatar of vi_srikanth
vi_srikanth

asked on

Threads - Shared - Reference

Hi Friends, I have the following code:

use threads;
use threads::shared;
my $a='abc';
my $b : shared = \$a;

For this, I'm getting the error: Invalid value for shared scalar at del.pl line 4.

Basically, I would like to have a variable(here $b) which is shared and holds a reference. Is this possible? If so please help me.

Thanx
ASKER CERTIFIED SOLUTION
Avatar of Mercantilum
Mercantilum
Flag of Japan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So, you could simply

use threads;
use threads::shared;
my $bar : shared;
my $foo : shared;
$foo = \$bar;