Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Answer: How does Perl handle strings with embedded NULLs?

( #27641=categorized answer: print w/ replies, xml ) Need Help??

Q&A > strings > How does Perl handle strings with embedded NULLs? - Answer contributed by Corion

There are places where embedded \000 characters will get you into trouble, but Perl can read and write such files without problems, since Perl uses counted strings.

Be warned though that passing such strings to anything like a system routine (like open() or -x), that take null-terminated strings as arguments, you will have problems or security holes.

  • Comment on Answer: How does Perl handle strings with embedded NULLs?
Replies are listed 'Best First'.
RE: Answer: How does Perl handle strings with embedded NULLs?
by strredwolf (Chaplain) on Aug 13, 2000 at 11:39 UTC
    That answers it nicely. As is, I'm planning to slurp it all in and then do a
    @msgid=split /\000/, $data; foreach $j (@msgid) { $mid($j}++; }

    (reason? I wanna filter my POP account by already-dl'ed message-id's)

    --
    Perl is intergalactic! WolfSkunks use it!

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2016-07-25 22:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (230 votes). Check out past polls.