19Jul/110
perl regexp – threat whole string as one line
s
- Treat the whole string as one line, so that even /./
will match a "newline" character.
#!/usr/bin/perl my $multiline = "In the town where I was born,\n" . "Lived a man who sailed to sea,\n" . "And he told us of his life,\n" . "In the land of submarines."; if ($multiline =~ /born,.Lived/s) { print "found\n"; # found in deed } else { print "not found\n"; }
Leave a comment