in reply to Re^2: Data Between Threads
in thread Data Between Threads

The shift function in a subroutine takes the first item from the parameter list @_, which in threadA's case is the Thread::Queue object $Qab. It was put there by the threads->new(...) method call. threadB has two parameters, so he used an alternate syntax for that. He could have written:

sub threadB { my $Qab = shift; my $Qbc = shift; ...

He puts the undef value in the queue as a way of indicating to whatever process uses the queue that it has reached the last value. When threadB's while loop gets this value, it will terminate. If this value was not there, the dequeue method would keep waiting for a value.

But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)