in reply to Re: Getting element of array with a match
in thread Getting element of array with a match
This of course blindly assumes that you're data is a linear, contiguous set of numbers.my @ar = map { chomp; $_ } <DATA>; print +(split /,/, $ar[ grep { /^(\d+)/ and $1 < 1006 } @ar ])[1], $/; __DATA__ 1001,choochoo 1002,candycane 1003,sockpuppet 1004,choochoo 1005,candycane 1006,sockpuppet6 1007,foo 1008,bar
_________
broquaint
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Getting element of array with a match
by peppiv (Curate) on Dec 23, 2002 at 16:04 UTC |