in reply to Find Element of array but use the next Element

I prefer "functional" solutions without an explicit loop:
my @array = ('app', 'Oracle', 'EPDMCA', 'Oracle' ,'EPZXC'); my @ora_succs = map { $array[$_+1] } grep { $array[$_] eq "Oracle" } 0 +..$#array;
Note that your problem is not clearly defined as you would need to specify the desired behaviour in the cases where "Oracle" is the last element or where an "Oracle" is followed by another "Oracle".

Replies are listed 'Best First'.
Re^2: Find Element of array but use the next Element
by NetWallah (Canon) on Jun 15, 2012 at 15:56 UTC
    Brilliant!. Simple ! Direct !. No Kludge. Love it.

    Now - why didn't I come up with that.

                 I hope life isn't a big joke, because I don't get it.
                       -SNL