in reply to Contents of a file into a scalar
Tip #1 from the Basic debugging checklist: warnings. I get this when I run your first example:
Argument "\n" isn't numeric in addition (+) at ...
I think you are enforcing numeric context by using + in your print. This works for me:
print $string, "\n";
And remember... Slurp it good :)
|
|---|