in reply to lvalues in perl prior to 5.16.3 throws "Can't modify reference constructor in lvalue subroutine return"

I guess (?) you are trying to apply the lvalue attribute on an anonymous sub.

I wouldn't expect this to work, ( well it does in 5.14 see update 2)

You may try creating a temporary named sub with lvalue and pass the reference, but I'm not sure about implementation details and side effects.

update 1

Since when are lvalue subs allowed to use return ?

update 2

was able to test now and 5.14 allows anonymous lvalue subs, but return won't work.

perl -e' $z=10; $x=sub :lvalue { $z}; (&$x)=42; print &$x; ' 42

maybe try to further isolate the problem...

Cheers Rolf

PS: Je suis Charlie!

  • Comment on Re: lvalues in perl prior to 5.16.3 throws "Can't modify reference constructor in lvalue subroutine return"
  • Select or Download Code