or better yet,local $/;
For more on $/... perlvar
In reply to Re^2: How to make a variable in a single line (remove newlines) by bcarroll in thread How to make a variable in a single line by auhakim