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

Slicing conflict

Thread Next
From:
Luke Palmer
Date:
April 11, 2005 23:30
Subject:
Slicing conflict
Message ID:
20050412063042.GA29831@navi.cx
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?

Luke

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