my $str = "abc\ndef"; $str =~ /(b.*e)/; print "1[$1]\n"; # 1[] Use of uninitialized value! $str =~ /(b.*e)/s; print "2[$1]\n"; # 2[bc\nde]