On Thu, Jul 04, 2019 at 02:10:22PM +0200, Vincent Lefevre wrote:
> Package: perl
> Version: 5.28.1-6
> Severity: normal
> 
> The following does no yield any error:
> 
>   perl -e 'use strict; my $x = - Inf;'
> 
> This does not seem to be intended.

Inf is not special here, other strings behave similarly.

Googling a bit turns up

 
https://stackoverflow.com/questions/23215511/ambiguous-use-of-constant-resolved-as-constant

 https://www.perlmonks.org/?node_id=1047125

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.
-- 
Niko Tyni   nt...@debian.org

Reply via email to