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 |