Help for this page

Select Code to Download


  1. or download this
    use List::MoreUtils qw( indexes );
    
    ...
    
    defined $array[$_+1] && print "$array[$_+1]\n"
        for indexes { $_ eq 'Oracle' } @array;
    
  2. or download this
    my @array = qw( app Oracle EPDMCA Oracle EPZXC );
    
    print "$array[$_]\n" 
        for grep { $_>0 && $array[$_-1] eq 'Oracle' } 0 .. $#array;
    
  3. or download this
    print "$array[$_]\n" for indexes {
        state $prev    = '';
    ...
        $prev = $_;
        $compare eq 'Oracle';
    } @array;
    
  4. or download this
    print "$_\n" for grep {
        state $ix = -1;
        my $cmp_idx = $ix++;
        $cmp_idx >=0 && $array[$cmp_idx] eq 'Oracle';
    } @array;
    
  5. or download this
    my @array = qw( app Oracle EPDMCA Oracle EPZXC );
    my $ix = 0;
    ...
        print $array[$ix+1] if $array[ix] eq 'Oracle';
        $ix++;
    }