On Wed, Nov 06, 2002 at 12:54:12PM -0500, Mark J. Reed wrote:
> 
> On 2002-11-06 at 11:43:20, Jonathan Scott Duff wrote:
> > 
> > Will there be some shorter-hand way to say these?
> > 
> >     @a = @grades[grep $_ >= 90, @grades];
> >     @b = @grades[grep 80 <= $_ < 90, @grades];
> >     @c = @grades[grep 70 <= $_ < 80, @grades];
> I think what you mean here is just
> 
>         @a = grep $_ >= 90, @grades;
> 
> etc.  grep returns the actual elements, not their indices, so it doesn't
> make sense to use them as a slice.  

Er, yeah.   I must be subcaffienated right now.  :-(

What I was trying to get at was the ability to slice based on the values
instead of the indices. But maybe it's just the python programming that
I've been doing that makes me think it's useful.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to