in reply to Changing $/ mid-file
If you take out the second while, it looks fine to me. Try this:
while (<DATA>) { chomp; print "-$_-\n"; if (/aaaa$/) { $/ = '%'; } } __END__ XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXaaaa abcdefghijklm%nopqrstuvw%xyz
|
|---|