submersible_toaster has asked for the wisdom of the Perl Monks concerning the following question:
While fiddling around with 5.8.0 and threads I found problems getting the correct return from my threads using ->join Returning a scalar seems to be no problem but trying to return an array or hash seem to be evaluated in scalar context.
#!/usr/dev/perl/bin/perl -w use strict; use threads; use Data::Dumper; my $thread = threads->new( sub { my %foo; @foo{1..100} = (1..100); print Dumper %foo; return %foo } ); print "Upon Joining ", $thread->join;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: threads->join Return Context.
by submersible_toaster (Chaplain) on Nov 19, 2002 at 06:48 UTC | |
|
Re: threads->join Return Context.
by Aristotle (Chancellor) on Nov 20, 2002 at 15:25 UTC |