my $s = <<__end_of_string__; start checking script end __end_of_string__ my ($match) = $s =~ /start(.*?)end/ims; print $match;