in reply to RE: RE: RE: Re: require problems
in thread require problems

But what is really special about "0 but true" is that it becomes 0 in a numeric context without a warning.
ding ding ding ding, that's what I was looking for!

And now for trivia question 2, "why is this so?"

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: RE: RE: RE: Re: require problems
by mirod (Canon) on Sep 19, 2000 at 22:19 UTC

    Is that a Perl feature or just because whatever the C function that turns strings into number is it likes the fact that it starts with a 0 and doesn't complain about the rest of the string? In which case "0 but" would be OK too?

      The Perl code that converts strings to integers specifically checks for "0 but true". "0 but True" will generate a warning in a numeric context, for example:

      % perl -we "print 0+'0 but True'" Argument "0 but True" isn't numeric in addition (+) at -e line 1. 0 % perl -we "print 0+'0 but true'" 0
              - tye (but my friends call me "Tye")