Probably because -k looks too much like one of the -X filetest operators (eg. -s -e -d etc.).
If you use upper case for your constant names as is generally advised, the parser has an additional clue which it uses to work out the right way to parse the statement and does so, albeit that it issues a friendly warning in the process.
use constant K => 2; print 1 - K; -1 print 1 -K; Ambiguous use of -K resolved as -&K() at ... -1
In reply to Re: syntax error with constant
by BrowserUk
in thread syntax error with constant
by chunlou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |