in reply to Re: Replacing everything in between using s///;
in thread Replacing everything in between using s///;

An s flag tells the regex to ignore line boundaries, which it won't do normally.

I wouldn't put it that way. /s makes newlines a valid match for ".". Moreover, perl normally does ignore internal line boundaries unless one tells it not to with /m. E.g.

my $s = "a\nb\nc\n"; my @g = map "[$_]", $s =~ /(.)$/g; my @gs = map "[$_]", $s =~ /(.)$/gs; my @gm = map "[$_]", $s =~ /(.)$/gm; my @gsm = map "[$_]", $s =~ /(.)$/gsm; print "g: @g\n"; print "gs: @gs\n"; print "gm: @gm\n"; print "gsm: @gsm\n"; __END__ g: [c] gs: [c] [ ] gm: [a] [b] [c] gsm: [a] [b] [c] [ ]
Note in particular the case in which both /s and /m are used.

the lowliest monk