Liz,

I just saw your thread on p5p about this.

Consider this...

--
use strict;

sub myfunc {
        wantarray ? [1, 2] : 3;
}

my( $one, $two ) = @{ &myfunc };

print "$one, $two\n";
--

One would expect that to work but the context is getting lost.

-J

--
"Suppose you were an idiot. And suppose you were a member of Congress. But I repeat 
myself." -- Mark Twain

On Sun, 27 Oct 2002, Joshua Hoblitt wrote:

>
> my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] };
>
> works.
>
> line 104: while ( my( $host, $ret ) = @{ ($q->dequeue_dontwait)[0] } ) {
>
> throws:
>
> thread failed to start: Can't use an undefined value as an ARRAY reference at 
>lib/PolycomStatus.pm line 104
>
> I'd be happy to share the whole module with you if you like (it's short but a scary 
>mess).
>
> Have you brought this up on p5p or should I file a perlbug?
>
> -J
>
> --
> "Suppose you were an idiot. And suppose you were a member of Congress. But I repeat 
>myself." -- Mark Twain
>
> On Sun, 27 Oct 2002, Elizabeth Mattijsen wrote:
>
> > At 10:41 AM 10/27/02 -1000, Joshua Hoblitt wrote:
> >
> > > > my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] };
> > >
> > >This is causing a compile error for me. I tried just [] as well.
> > >
> > >[Sun Oct 27 10:31:57 2002] PolycomStatus.pm: syntax error at
> > >PolycomStatus.pm line 104, near "->dequeue_dontwait["
> > >[Sun Oct 27 10:31:57 2002] PolycomStatus.pm: PolycomStatus.pm had
> > >compilation errors.
> >
> > You _must_ put parentheses around it first:
> >
> >    ($q->dequeue_dontwait)[0]
> >
> >
> >  > while ( my( $host, $ret ) = @{ $q->dequeue_dontwait } ) {
> >
> > while ( my( $host, $ret ) = @{ ($q->dequeue_dontwait)[0] } ) {
> >
> > should work...
> >
> >
> > Liz
> >
> >
>
>

Reply via email to