in reply to find a string into an interval

I'm not sure what you want. If shenme's reply doesn't help, this might:

while (<DATA>) { print if (/string1/../string2/) && /string3/; # Only prints "string3 2" } __DATA__ bla bla string3 1 foo foo string1 bar bar string3 2 bah bah string2 feh feh string3 3 moo moo