in reply to Re: How to specify a Null char in a match operation
in thread How to specify a Null char in a match operation

No, print doesn't truncate at \0 chars. I guess that's platform specific (you're on Windows?). Try
use strict; use warnings; binmode STDOUT; my @strs = ("filename1.txt\0", "filename2\0.txt", "filename3.txt"); /\0/ && ((print "Null char detected in >$_<"), print "\n") for @strs;

If you still see truncated strings, it might be the terminal's fault. On linux, piping the output to a pager, I see

Null char detected in >filename1.txt^@< Null char detected in >filename2^@.txt<

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^3: How to specify a Null char in a match operation
by swampyankee (Parson) on Oct 11, 2006 at 19:58 UTC

    With shmem's code, I get this output in a Windows command shell:

    Null char detected in >filename1.txt < Null char detected in >filename2 .txt<

    and replicate shmem's output when going through emacs.

    emc

    At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

    —Igor Sikorsky, reported in AOPA Pilot magazine February 2003.