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
In reply to Re: Changing $/ mid-file
by eg
in thread Changing $/ mid-file
by jgallagher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |