while ( <<"EOT" =~ m/(.*is.*)/g ) This is my text, isn't it? EOT { print $1,"\n"; }