On Tue, Sep 28, 2010 at 07:07:38PM -0400, Greg London wrote:
Ive used $arr[-2] to get the second to last element of an array.
But anyone using $[ to change the first index of an array to be negative
should be beaten severely.
No, anyone using $[ at all should be beaten severely :-)
On Tue, Sep 28, 2010 at 10:23:27PM -0400, Gyepi SAM wrote:
I think '$[' would more useful if it could be scoped to individual arrays.
It shouldn't be difficult to knock up a Tie::Whatever module to simulate
that.
Though it does seem to be of dubious utility to begin with.
It's only in the
DC == David Cantrell da...@cantrell.org.uk writes:
DC On Mon, Sep 27, 2010 at 11:15:17PM -0400, Uri Guttman wrote:
actually the = part is even more amusing. look here:
perl -le '$#foo = -2 ; print $#foo'
-1
you can't set the last index to -1. which makes sense. which makes the
From: Uri Guttman u...@stemsystems.com
Date: Wed, 29 Sep 2010 15:14:37 -0400
DC == David Cantrell da...@cantrell.org.uk writes:
DC On Mon, Sep 27, 2010 at 11:15:17PM -0400, Uri Guttman wrote:
you can't set the last index to -1. which makes sense. which makes the
r == rogers-pm5 rogers-...@rgrjr.dyndns.org writes:
r I have used languages (PL/1 and Pascal come to mind) that allow you to
r declare both upper and lower bounds to each array dimension. But for
r both languages, I have found such arrays more trouble than they are
r worth. A Pascal
On Mon, Sep 27, 2010 at 11:15:17PM -0400, Uri Guttman wrote:
actually the = part is even more amusing. look here:
perl -le '$#foo = -2 ; print $#foo'
-1
you can't set the last index to -1. which makes sense. which makes the
original code even dumber.
$ perl -le '$[=-1; print $#foo'
-2
the awards.
-Original message-
From: David Cantrell da...@cantrell.org.uk
To: boston-pm@mail.pm.org
Sent: Tue, Sep 28, 2010 11:50:27 GMT+00:00
Subject: Re: [Boston.pm] $#{$Queue}
On Mon, Sep 27, 2010 at 11:15:17PM -0400, Uri Guttman wrote:
actually the = part is even more amusing. look
Greg London wrote:
From: David Cantrell da...@cantrell.org.uk
On Mon, Sep 27, 2010 at 11:15:17PM -0400, Uri Guttman wrote:
actually the = part is even more amusing. look here:
perl -le '$#foo = -2 ; print $#foo'
-1
you can't set the last index to -1. which makes sense. which makes the
On Tue, Sep 28, 2010 at 07:07:38PM -0400, Greg London wrote:
Ive used $arr[-2] to get the second to last element of an array.
But anyone using $[ to change the first index of an array to be
negative should be beaten severely.
I had initially thought this too; though I imagined something
worse
From: Gyepi SAM gy...@praxis-sw.com
Date: Tue, 28 Sep 2010 22:23:27 -0400
. . .
I think '$[' would more useful if it could be scoped to individual
arrays.
I have used languages (PL/1 and Pascal come to mind) that allow you to
declare both upper and lower bounds to each array
On Tue, Sep 28, 2010 at 11:11 PM, rogers-...@rgrjr.dyndns.org wrote:
I have used languages (PL/1 and Pascal come to mind) that allow you to
declare both upper and lower bounds to each array dimension. But for
both languages, I have found such arrays more trouble than they are
worth. A
User-defined array indexing is included in Perl 6:
my Int @array{1970..1984};
Huh???
An explicit type declaration in Perl??
Who ordered this?
No more scalar = catch all type?
-T
___
Boston-pm mailing list
Boston-pm@mail.pm.org
On Wed, Sep 29, 2010 at 12:37 AM, tk...@bu.edu wrote:
An explicit type declaration in Perl??
Who ordered this?
No more scalar = catch all type?
No worries, you can just continue using untyped scalars as you always have!
my $scalar;
But you can also declare types and array sizes if you
what the heck?
my $Queue = \...@somearray;
if ($#{$Queue} = -1){
# do something
}
I thought $# was size,
but the code is checking for it to be minus one?
--
___
Boston-pm mailing list
Boston-pm@mail.pm.org
Check perlvar. It is the index of the last array element, which is
one less than the size.
@$Queue will give you the size in scalar context.
On Mon, Sep 27, 2010 at 5:28 PM, Greg London em...@greglondon.com wrote:
what the heck?
my $Queue = \...@somearray;
if ($#{$Queue} = -1){
# do
...@greglondon.com
Cc: boston-pm@mail.pm.org
Sent: Tue, Sep 28, 2010 00:29:52 GMT+00:00
Subject: Re: [Boston.pm] $#{$Queue}
Check perlvar. It is the index of the last array element, which is
one less than the size.
@$Queue will give you the size in scalar context.
On Mon, Sep 27, 2010 at 5:28 PM
GL == Greg London Greg writes:
GL Oh god. I'm digging through what might be on the order of.a
GL hundred thousand lines of perl code on a system. The file that
GL snippet came from is over ten thousand lines long. My brain is
GL about to implode.
better that it implode instead of
From: Greg Londonem...@greglondon.com
Date: Mon, 27 Sep 2010 20:49:49 -0400
Oh god. I'm digging through what might be on the order of.a hundred
thousand lines of perl code on a system. The file that snippet came
from is over ten thousand lines long. My brain is about to implode.
r == rogers-pm5 rogers-...@rgrjr.dyndns.org writes:
rFrom: Greg Londonem...@greglondon.com
rDate: Mon, 27 Sep 2010 20:49:49 -0400
rOh god. I'm digging through what might be on the order of.a hundred
rthousand lines of perl code on a system. The file that snippet came
From: Uri Guttman u...@stemsystems.com
Date: Mon, 27 Sep 2010 23:15:17 -0400
actually the = part is even more amusing. look here:
perl -le '$#foo = -2 ; print $#foo'
-1
;
you can't set the last index to -1. which makes sense. which makes the
original code even dumber.
r == rogers-pm5 rogers-...@rgrjr.dyndns.org writes:
rFrom: Uri Guttman u...@stemsystems.com
rDate: Mon, 27 Sep 2010 23:15:17 -0400
ractually the = part is even more amusing. look here:
rperl -le '$#foo = -2 ; print $#foo'
r-1
r ;
ryou can't set the last
21 matches
Mail list logo