develooper Front page | perl.perl6.language | Postings from April 2005

Slicing conflict

Thread Next
Luke Palmer
April 11, 2005 23:30
Slicing conflict
Message ID:
In Perl 5:

    my @a = (1,2,3);
    my @b = @a[0..3];
    print scalar(@b);   # 4

But in Perl 6:

    my @a = (1,2,3,4);
    my @b = @a[1...];  # elements from 1 onward
    say +@b;   # should probably be 3, but with Perl 5 semantics is Inf

We have to break one of these.  I think the former is the one to break,
even though that might cause some unexpected surprises here and there.
Any ideas?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About