Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Answer: How does Perl handle strings with embedded NULLs?

by Corion (Pope)
on Aug 12, 2000 at 21:57 UTC ( #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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2017-04-26 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (484 votes). Check out past polls.