I am trying to do a simple multi-line substitution in perl, but encountering intractable weirdness. How in the world do I replace BOTH of the lines with "FOOBAR"? The file does not appear to have any windows/dos-style line breaks or CR characters.
# ls -l fb
-rw------- 1 aaronc devel 8 Nov 3 11:28 fb
# cat fb
foo
bar
# cat fb | perl -nle '$_ =~ s/foo/FOO/; print $_'
FOO
bar
# cat fb | perl -nle '$_ =~ s/foo\nbar/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/foo$bar/FOOBAR/m; print $_'
FOOBAR
bar
# cat fb | perl -nle '$_ =~ s/^foo$bar$/FOOBAR/m; print $_'
FOOBAR
bar
# cat fb | perl -nle '$_ =~ s/^foo$^bar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo\nbar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo\nbar$/FOOBAR/mg; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/foo\nbar/FOOBAR/mg; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo$\n^bar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo$\n^bar$/FOOBAR/mg; print $_'
foo
bar
-- Aaron
# ls -l fb
-rw------- 1 aaronc devel 8 Nov 3 11:28 fb
# cat fb
foo
bar
# cat fb | perl -nle '$_ =~ s/foo/FOO/; print $_'
FOO
bar
# cat fb | perl -nle '$_ =~ s/foo\nbar/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/foo$bar/FOOBAR/m; print $_'
FOOBAR
bar
# cat fb | perl -nle '$_ =~ s/^foo$bar$/FOOBAR/m; print $_'
FOOBAR
bar
# cat fb | perl -nle '$_ =~ s/^foo$^bar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo\nbar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo\nbar$/FOOBAR/mg; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/foo\nbar/FOOBAR/mg; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo$\n^bar$/FOOBAR/m; print $_'
foo
bar
# cat fb | perl -nle '$_ =~ s/^foo$\n^bar$/FOOBAR/mg; print $_'
foo
bar
-- Aaron