#!/usr/bin/perl use strict; use warnings; while () { 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