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

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

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 15, 2013 14:10
Subject:
[perl #119797] lvalue sub shows "Bizarre copy of ARRAY in block exit" in very specific case.
Message ID:
rt-3.6.HEAD-1873-1379254248-1060.119797-15-0@perl.org
On Sun Sep 15 06:21:00 2013, jkeenan wrote:
> ##########
> $ cat 119797-lvalue.pl 
> my @this = (1..5);
> 
> (that()) = ();
> print "@this\n";
> 
> sub that :lvalue { if (@this) { } else { @this; } }
> ##########
> $ perl 119797-lvalue.pl 
> 1 2 3 4 5
> ##########
> 
> I don't think there is a bug here.

Your version puts something in the array, avoiding the else block.

Try this:

#!perl
my @this = ();

(that()) = ();
print "@this\n";

sub that :lvalue { if (@this) { } else { @this; } }
__END__

That gives me a bizarre copy.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119797

Thread Previous | 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