|Pathologically Eclectic Rubbish Lister|
Answer: How does Perl handle strings with embedded NULLs?by graff (Chancellor)
|on Jul 10, 2003 at 09:28 UTC||Need Help??|
If by "slurp it all in" you mean something like:
then Perl will certainly have no trouble at all reading all the data and assigning it all to $_, no matter what it contains. It will print it all out to STDOUT or any file handle as well (but you may need to be careful if the file handle is actually a pipe to a less forgiving process).
Plain old line-based I/O will also treat nulls just like any other character that isn't (part of) a line terminatation -- lines containing nulls will be fully read and written.
Of course, sometimes it makes sense to use nulls as the input record separator:
In addition to matching nulls exactly with "\x00" in regexes, Perl also matches them via the "." wildcard, and the negated character classes "\S", "\D", "\W", and so on.