develooper Front page | perl.perl5.porters | Postings from October 2013

Re: [perl #119797] lvalue sub shows "Bizarre copy of ARRAY in block exit" in very specific case.

Thread Next
From:
Konrad Borowski
Date:
October 24, 2013 11:04
Subject:
Re: [perl #119797] lvalue sub shows "Bizarre copy of ARRAY in block exit" in very specific case.
Message ID:
1680700.IC8za2ZY4b@tomato
Dnia środa, 23 października 2013 21:34:26 piszesz:
> Also, should while and for loops be able to return lvalues?  I have
> always been confused as to whether the last statement inside a loop can
> be implicitly returned, so I have simply avoided depending on that.  I
> don’t know the answer here.

I checked. For some reason, subroutine or `do` block ending with `while` block 
or `for` block always returns empty string (not `undef` or last statement, as 
I could've expected). This is probably strange unintentional value, but I 
think it may be kept here for backwards compatibility.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About