develooper Front page | perl.perl5.porters | Postings from January 2014

Re: Range idea

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
January 23, 2014 14:41
Subject:
Re: Range idea
Message ID:
20140123154139.229088f0@pc09.procura.nl
On Thu, 23 Jan 2014 15:11:40 +0100, "Dr.Ruud"
<rvtol+usenet@isolution.nl> wrote:

> On 2014-01-23 13:25, H.Merijn Brand wrote:
> 
> > Wanting to take all the elements from a list starting at position x to
> > the end is pretty hard when the list is dynamic, so $#list cannot be
> > used, nor can index -1
> 
> Just for fun:
> 
> perl -wE'
>    say for qw( a b c d )[2 .. NaN];
> '
> 
> 
> perl -wE'
>    say for qw( a b c d )[2 .. Inf];
> '
> Range iterator outside integer range at -e line 2.

I tried those too, just to check if using MAX_INT would be an option,
but it currently apparently is not

$ perl -wE'say for (qw( a b c d ))[2..10]'
c
d
Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.

Use of uninitialized value in say at -e line 1.


Imagine what MAX_INT would yield instead of 10 :)

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.19   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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