in reply to find a string into an interval

Something else may be going wrong, as this works:
#!/usr/bin/perl use strict; use warnings; while (<DATA>) { print if /string1/../string2/; } close DATA; 1; __DATA__ this is string0 line and this is string1 line this might be string1a line and this line has string2 to finish, string3 line ends it all
produces output
 and this is string1 line
 this might be string1a line
     and this line has string2
Note that sometimes people use the __DATA__ feature to show file I/O related code. Please don't let that confuse you.