On 2019-07-04 16:57:22 +0300, Niko Tyni wrote: > and the following passage in perlop: > > Unary "-" performs arithmetic negation if the operand is numeric, > including any string that looks like a number. If the operand is an > identifier, a string consisting of a minus sign concatenated with > the identifier is returned. > > So it looks like this is intentional or at least documented > behaviour that we're stuck with.
No, that's just the default behavior, without strict subs. Similarly, the perlop(1) man page says: Unary "+" has no effect whatsoever, even on strings. [...] Thus: zira:~> perl -e 'my $x = -Inf; print "$x\n";' -Inf zira:~> perl -e 'my $x = +Inf; print "$x\n";' Inf as documented. But with "use strict;", the one with +Inf gives an error, but not the one with -Inf. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)