This is in addition to what thelenm already said.
{
local $/ = ".ENDS\n";
}
while (<SCH>){
# ...
}
I see where you are going with this - good idea.
However, the value of $/ will be changed back to "\n"
right before the while() loop and you'll end up reading the
file line-by-line.
To fix, enclose the whole while loop in the same block as
the "local $/;"
{
local $/ = ".ENDS\n";
while (<SCH>){
# ...
}
}
--perlplexer