in reply to file alteration

Use the input record separator:
local $/ = "A\nB\n"; chomp, print while <>;

Just make sure your files end in a newline, otherwise the last "A\nB" at the EOF won't be removed.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ