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)

Paul

--- "Hodges, Paul" <[EMAIL PROTECTED]> wrote:
> 
> Every now and then I have this discussion with people at work that
> involve Perl's ideas of boolean truth. I usually break it down like
> this:
> 
> In Perl5, the following values are FALSE: undef, '0', 0, and ''.
>  
> Anything not in that list is considered TRUE in a boolean context.
> That means that Perl5 has some notions of truth that confuse some
> folk. I mean, I can understand "00" being true, even if it seems a
> little odd to me personally, but "\0"??? How is a single null byte
> *true*?
> 
> Okay, so it's binary data. So is "0" and 0, if you look at it that
> way. I realize the internal representations are different, but the
> programmer shouldn't have to care about that. I just figure that if
> my bit of $data contains one byte, and I'm checking that $data for
> boolean truth, I'd expect a null to be false, as would ba-zillions of
> C programmers (from which backgroud I came). I know we aren't trying
> so hard to imitate C behavior anymore, but still, doesn't this
> violate the principle of least surprise?
> 
> So my question is this, with apology for the ramble....
> aside from P6's other changes, is a single null byte of binary data
> still going to register as TRUE, or will it now be what seems to me
> the more sensible FALSE?
> 
> Paul



                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

Reply via email to