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

yet another 5.10 issue

Thread Next
From:
Tom Christiansen
Date:
September 13, 2011 15:55
Subject:
yet another 5.10 issue
Message ID:
9879.1315954489@chthon
How many bugs can you count here?  I count at least two.

    $ perl -we @arr1=(); @arr2=(1,2,3); @arr3=@arr1//@arr2;print "[@arr3]\n" 
    [0]
    $ perl -we @arr1=(); @arr2=(1,2,3); @arr3=@arr1||@arr2;print "[@arr3]\n"
    [1 2 3]
    $ perl -we @arr1=(); @arr2=(1,2,3); @arr3=defined(@arr1)? scalar(@arr1) : @arr2;print "[@arr3]\n"
    [1 2 3]
    $ perl -we my @arr1=(); my @arr2=(1,2,3); my @arr3=@arr1//@arr2;print "[@arr3]\n" 
    [0]
    $ perl -we my @arr1=(); my @arr2=(1,2,3); my @arr3=@arr1||@arr2;print "[@arr3]\n"
    [1 2 3]
    $ perl -we my @arr1=(); my @arr2=(1,2,3); my @arr3=defined(@arr1)? scalar(@arr1) : @arr2;print "[@arr3]\n"
    defined(@array) is deprecated at -e line 1.
            (Maybe you should just omit the defined()?)
    [1 2 3]

--tom

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