Moron has asked for the wisdom of the Perl Monks concerning the following question:

In an idle moment, I checked if this would compile (I was using v5.6.1):
much: do ~0;
And this is the error it produced:
Perl v18446744073709551615.0.0 required--this is only v5.6.1, stopped +(did you mean v18446744073709551615.0.0?) at -e line 1.
Curiously, adding '. "\n" after the 0 made it compile ok. But having found nothing relevant in the documentation, it does make me wonder what is happening here.

Update: By experiment, ~0 seems to produce a large (max?) integer value. So it looks like it is behaving like a "require ~0;", which reduces the mystery while still being unexpected.

-M

Free your mind

Replies are listed 'Best First'.
Re: Supported in far future version?
by Mutant (Priest) on Dec 15, 2005 at 13:19 UTC
    Unary ~ is the One's complement operator, which is why it's producing large integers.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Supported in far future version?
by blazar (Canon) on Dec 15, 2005 at 14:03 UTC

    This doesn't happen with 5.8.6 here. Whatever, ~0 is binary complement of zero, i.e. indeed a "largish" integer (but not if you're on a 4 bit processor!;-).

    I do get the same behaviour if I s/do/require/, so it seems that your perl is interpreting do that way. Maybe checking some perldelta may reveal a change that has occured in the meanwhile.

    Try running your script through B::Deparse and maybe that could shed some light on how perl is interpreting it.

    Perl v18446744073709551615.0.0 required--this is only v5.6.1, stopped +(did you mean v18446744073709551615.0.0?) at -e line 1.

    Hmmm... so you're on a 64-bit machine!! I don't...

    $ perl -le 'print~0' 4294967295
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Supported in far future version?
by ambrus (Abbot) on Dec 15, 2005 at 22:23 UTC

    much: do ~0; compiles and runs and appears to do nothin with my perl. require ~0; however, produces this error:

    Perl v4294967295.0.0 required (did you mean v4294967295.000?)--this is + only v5.8.5, stopped at -e line 1.

    To supress this message, try adding use integer; before the statement. :)