Re: grep array of arrays

2012-08-24 Thread Brandon McCaig
On Thu, Aug 23, 2012 at 05:19:34PM -0400, Shawn H Corey wrote: > You're trying to do too much in one statement. > > for my $coord ( @coords ){ > if( $coords->[0] >= 0 ){ > print join( q{, }, @{ $coords } ), "\n"; > } > } Looks like you're trying to do too much too. ;) You are test

Re: grep array of arrays

2012-08-23 Thread Shawn H Corey
On Thu, 23 Aug 2012 14:17:26 -0700 Jim Gibson wrote: > You could also combine print, grep, and map to accomplish the same > thing. Please don't. If you're having this much trouble getting it right, the person stuck with maintaining it will also have trouble understanding what you coded. Break it

Re: grep array of arrays

2012-08-23 Thread Shawn H Corey
On Thu, 23 Aug 2012 15:58:43 -0500 Chris Stinemetz wrote: > print grep { $_->[0] >= 0 } @coords; You're trying to do too much in one statement. for my $coord ( @coords ){ if( $coords->[0] >= 0 ){ print join( q{, }, @{ $coords } ), "\n"; } } -- Just my 0.0002 million dolla

Re: grep array of arrays

2012-08-23 Thread Jim Gibson
On Aug 23, 2012, at 1:58 PM, Chris Stinemetz wrote: >> >> >> If @coords is just an Array of Arrays then that should be: >> >> print grep { $_->[0] >= 0 } @coords; >> >> >> Your example thinks @coords is an Array of Arrays of Arrays. >> >> >> John >> -- >> > > print grep { $_->[0] >= 0 }

Re: grep array of arrays

2012-08-23 Thread Chris Stinemetz
> > > If @coords is just an Array of Arrays then that should be: > > print grep { $_->[0] >= 0 } @coords; > > > Your example thinks @coords is an Array of Arrays of Arrays. > > > John > -- > print grep { $_->[0] >= 0 } @coords; Just prints the memory adress: ARRAY(0x29d459c)ARRAY(0x29d462c)ARRAY(

Re: grep array of arrays

2012-08-23 Thread Jim Gibson
On Aug 23, 2012, at 12:57 PM, Chris Stinemetz wrote: > Hello List, > I'm trying to grep an array of arrays, but I am getting the following error: > > Can't use string ("1") as an ARRAY ref while "strict refs" in use at > form.pl line 121, <$COORDS> line 1281. > Press any key to continue . . . >

Re: grep array of arrays

2012-08-23 Thread John W. Krahn
Chris Stinemetz wrote: Hello List, Hello, I'm trying to grep an array of arrays, but I am getting the following error: Can't use string ("1") as an ARRAY ref while "strict refs" in use at form.pl line 121,<$COORDS> line 1281. Press any key to continue . . . Below is the grep statement: