in reply to Still slice impared

If $self is an array-ref...

my @slice = @{$self}[0..$n-1];

That ought to do it. The curly brackets are being used in this case for clarity. It can also be expressed like this:

my @slice = @$self[0..$n-1];

....at least in my test cases that seems to work just fine. ;)


Dave

Replies are listed 'Best First'.
Re: Re: Still slice impared
by John M. Dlugosz (Monsignor) on Feb 24, 2004 at 15:41 UTC
    Thanks.

    In my code, the actual results indicate that the array indexing takes the first element of the list only. But, any idea where the warning about "" not being a numeric argument could be coming from?

      From the ".." flipflop operator in scalar context.