Paul Hodges writes:
> I seemed to have opened a can of worms, lol....
> But did anybody see the one that had something to do with my question
> crawling around? (I've obviously missed a couple of messages. They're
> probably hanging out down at the router in the cyberspace equivelent of
> teenagers ogling girls on the street corner smoking cigs.....)
> 
> So, in P6:
> 
>   if 0     { print "0\n";     } # I assume this won't print.
>   if '0'   { print "'0'\n";   } # I assume this won't print.
>   if ''    { print "''\n";    } # I assume this won't print.
>   if undef { print "undef\n"; } # I assume this won't print.
> 
> But my question is, will this:
> 
>   if "\0" { print null\n"; } # Is this going to print, or not?
> 
> And if the answer is because I've somehow botched my syntax, please
> correct it and answer the question I obviously *meant* to ask as well? 
> =o)

As far as things are currently defined, yes, it will print.  And your
syntax is perfect... well, maybe not:

    if undef { print "undef\n"; }

Might be interpreted as:

    if undef( { print "undef\n"; } ) # syntax error, expecting {

But close enough anyway.

If you must check for a null byte, it's as simple as:

    unless $chr     { print "0, '', or '0' }
    unless ord $chr { print "null byte" }

Luke

Reply via email to