in reply to Changing $/ mid-file
It should work. The following code works fine:
#!/usr/bin/perl -w use strict; while (<DATA>) { if (/aaaa$/) { local $/ = '%'; # use local here for extra-cleanness ($/ is + restored to its previous state when you exit the block) while (<DATA>) { print "read: $_\n"; } } } __DATA__ XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXaaaa abcdefghijklm%nopqrstuvw%xyz
The problem must be somewhere else in your code.
This is actually one of my favorite tricks, it always impresses people who don't know it ;--)
|
|---|