Re: slices

2007-08-14 Thread Chas Owens
On 8/14/07, Jay Savage <[EMAIL PROTECTED]> wrote: snip > No. a single scalar subscript is, well, a scalar, not a single-element > list. And it refers to an index, not a slice. The definition of a > slice is more than one. from perldata: > > "A slice accesses several elements of a list, an array, or

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 9, 10:39 am, [EMAIL PROTECTED] wrote: > - Original Message - > From: Paul Lalli <[EMAIL PROTECTED]> > Date: Thursday, August 9, 2007 8:52 am > Subject: Re: slices > To: [EMAIL PROTECTED] > > > $ perl -wle'my @bar = qw/alph

Re: slices

2007-08-09 Thread kviel
- Original Message - From: Paul Lalli <[EMAIL PROTECTED]> Date: Thursday, August 9, 2007 8:52 am Subject: Re: slices To: beginners@perl.org > $ perl -wle'my @bar = qw/alpha beta gamma/;  @bar[

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 9, 8:29 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Aug 8, 11:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > > > Subject: slices > > > Your examples are not using slices. A slice implies a list (more than one) > > of > > indexes > > No "more than one" required. A 1 element list is

Re: slices

2007-08-09 Thread Paul Lalli
On Aug 8, 11:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > Subject: slices > > Your examples are not using slices. A slice implies a list (more than one) of > indexes No "more than one" required. A 1 element list is a list. @bar[0,1] = `$cmd`; assigns the first two lines of $cmd's output

Re: slices

2007-08-08 Thread John W. Krahn
Subject: slices Your examples are not using slices. A slice implies a list (more than one) of indexes oryann9 wrote: Trying to understand from perldoc perldata the diff between these 3 CLIs and why the 2nd CLI has no elements? From perldata: "A slice of an empty list is still an empty li

Re: slices

2007-08-08 Thread John W. Krahn
Lawrence Statton wrote: From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007 Return-Path: <[EMAIL PROTECTED]> X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: from localhost (localhost [127.0.0.1]) by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0 for <[

Re: slices

2007-08-08 Thread Jeff Pang
-Original Message- >From: oryann9 <[EMAIL PROTECTED]> >Sent: Aug 9, 2007 4:43 AM >To: Perl List >Subject: slices > >$ perl -le 'use Data::Dumper; @c = (0,1)[2]; print >Dumper([EMAIL PROTECTED]);' >$VAR1 = []; > > This is because the expression of '(0,1)[2]' would return undefined value

Re: slices

2007-08-08 Thread Lawrence Statton
> From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007 > Return-Path: <[EMAIL PROTECTED]> > X-Original-To: [EMAIL PROTECTED] > Delivered-To: [EMAIL PROTECTED] > Received: from localhost (localhost [127.0.0.1]) > by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0 > for <[EMAIL PROTECTED]

RE: slices

2007-08-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: oryann9 [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 08, 2007 13:44 > To: Perl List > Subject: slices > > Trying to understand from perldoc perldata the diff > between these 3 CLIs and why the 2nd CLI has no > elements? > > $ perl -le 'use Data::Dumper

Re: slices of hashes

2005-07-21 Thread Gerard Robin
On Thu, Jul 21, 2005 at 04:04:36PM -0400 Scott R. Godin wrote: > Gerard Robin wrote: > >Hello, > >the slices of hashes work strangely ... > > > > >PS > >if I write: > >@h3{"Mamadoo".."Lulu"} = (30, 40, 50 ); > >the script hangs (no error is displayed) > > > > yes because that's not a hash slice t

Re: slices of hashes

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, Gerard Robin said: my %h1 = (a => 1, b => 2, c => 3, d => 4, e => 5, f => 6); [snip] print " ", map{ $_." " } @h1{'b'..'e'}; [snip] @h1{'b'..'e'} = (20, 30, 40, 50); print " ", map{ $_." " } @h1{'b'..'e'}; What do you think 'b'..'e' is producing? It's producing the list ('b',

Re: slices of hashes

2005-07-21 Thread Scott R. Godin
Gerard Robin wrote: Hello, the slices of hashes work strangely ... PS if I write: @h3{"Mamadoo".."Lulu"} = (30, 40, 50 ); the script hangs (no error is displayed) yes because that's not a hash slice there: what happens when you do these: ? perl -wle 'print "Mamadoo","Lulu"' perl -wle 'pr

Re: Slices

2004-01-26 Thread Steve Grazzini
Paul Kraus wrote: Can I declare from this element to end with an array slice. @arary[3...] but this doesn't work?. You can refer to the last index with $#arary, so: @arary[3 .. $#arary]; Is that what you meant? -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-m

Re: Slices

2004-01-26 Thread wolf blaum
> > @arary[3...] but this doesn't work?. What about @array[3..$#array] PS: @arary = typo? Wolf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]