in reply to map sentence with subtraction interpreted as with negative number

I think your statement isn't only confusing to the parser, but to humans as well. The coding convention for infix operators (like * + - and / ) is to have symmetric spaces around it. Note that both those solutions work: perl -e 'print map $_-1, 1;' and perl -e 'print map $_ - 1, 1;'

If it had been another operator, like / I suppose you wouldn't have written it on one side: $a / $b looks ok, so does $a/$b but $a /$b looks weird. So even for humans, your code looks like $_ followed by negative one.

Edit: as far as I'm concerned though, a good coding convention would not to use the map EXPR, LIST syntax unless EXPR is a single element (ex chr or /regex/), or even never use it, as the map BLOCK LIST is less confusing.

Replies are listed 'Best First'.
Re^2: map sentence with subtraction interpreted as with negative number
by rsFalse (Chaplain) on Nov 25, 2015 at 14:06 UTC
    I started to save one space between - or + and a number, if a number is small, and my intention was - readability (not too much spaces, nor too less spaces). But of course when both operands are larger or variables, then I still use symmetric spaces.
    And it's difficult to understand an operator as unary, if you have read one more operand in left side of an expression. DWIM doesn't work.
    But ok, thanks for suggestions.