in reply to finding position of first occurence of 3 different stopping criteria

Getting back to capturing what matched and where, but use Not a Number's way of constructing the inner match:
my $s2 = '$endcod = index($s2eq, $end1 || $end2 || $end3, $s2tart +cod);'; while( $s2 =~ m/(end|dex|art)/g ) { printf " Found '%s' at %d\n", $1, pos($s2); }
Outputs:
  Found 'end' at 4
  Found 'dex' at 15
  Found 'end' at 27
  Found 'end' at 36
  Found 'end' at 45
  Found 'art' at 55
  • Comment on Re: finding position of first occurence of 3 different stopping criteria
  • Download Code