in reply to Re^2: why doesn't "my ($a,$b)" return a list?
in thread why doesn't "my ($a,$b)" return a list?

The problem stays even without prototypes.

Really? With a better prototype:

$ perl -wE 'sub list { 1, 2}; sub enum(\@@) { @_[1,2] = (1, 2)}; enum +my @a, state ($x, $y); say $x, $y' 12

Or with no prototype:

$ perl -wE 'sub list { 1, 2}; sub enum { @_[0,1] = (1, 2)}; enum my @a +, state ($x, $y); say $x, $y' 12

To me this looks like the scalar context from the prototype was the problem - our maybe you meant a different problem? If so, care to elaborate?

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^4: why doesn't "my ($a,$b)" return a list?
by LanX (Saint) on Aug 19, 2010 at 15:11 UTC
    yes sorry your right, I misintepreted the results of my tests, confusing the size of @_ with the value of the first parameter.

    I just realized in the meantime that this works:

    DB<22> sub tst3(\@;@) {print scalar @_} DB<23> use feature 'state'; tst3 @a, state ($x,$y) 3
    Thanks :)

    Cheers Rolf