2 ms·
Perl can do both ways: $ perl -E 'say(4 % -3)' -2 $ perl -E 'use integer;say(4 % -3)' 1
by tyingq 5y ago
Perl can do both ways:
$ perl -E 'say(4 % -3)'
-2
$ perl -E 'use integer;say(4 % -3)'
1
- floatboth 5y agoInterpreter state ("what's been `use`d") completely changing the meaning of that expression sounds like the worst possible way to do it.
- tyingq 5y agoIt is lexically scoped, so you can wall it off with a {} block. And there's 'no integer;' to turn it off as well. It's a pattern in Perl, like "use strict;" for example, which is also lexically scoped and has a "no strict;" counterpart.
- gpvos 5y agoMaybe it amounts to the same thing, but the example you give is not what the original post is about, which is -4 % 3 . It is true that "use integer" affects both calculations.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]