Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I humbly seek wisdom. The book of perlref says "When a scalar is holding a reference, it always behaves as a simple scalar" (Description, paragraph 5, verse 3)
Why then can I not put a hashref on a queue in Thread::Queue?
Example:
my $DataQueue = Thread::Queue->new; my $href = {'A'=>'1', 'B'=>'2', 'C'=>'3' }; $DataQueue->enqueue($href);
which produces:
Invalid value for shared scalar at C:/Perl/lib/Thread/Queue.pm line 90 +.
I understand that Thread::Queue only supports scalars, but I thought a reference was a scalar.
Also, is there a way to trick PERL into treating $href as a scalar?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scalars, references and queues
by liverpole (Monsignor) on Aug 03, 2007 at 14:29 UTC | |
|
Re: scalars, references and queues
by ikegami (Patriarch) on Aug 03, 2007 at 14:30 UTC | |
by BrowserUk (Patriarch) on Aug 03, 2007 at 15:38 UTC | |
|
Re: scalars, references and queues
by Anonymous Monk on Aug 03, 2007 at 15:11 UTC | |
by Anonymous Monk on Aug 03, 2007 at 21:19 UTC |