in reply to false warning: print (...) interpreted as function
splain explains the warning in this way:
(W syntax) You've run afoul of the rule that says that any list operator followed by parentheses turns into a function, with all the list operators arguments found inside the parentheses. See "Terms and List Operators (Leftward)" in perlop.
Updated:The warning would be useful if you closed the outer parentheses earlier:
print ((sort { $b <=> $a } grep defined, @_)[0]), " - was a max define +d value\n";
The common solution is not to use another parentheses, but to insert a +:
print +(sort { $b <=> $a } grep defined, @_)[0], " - was a max defined + value\n";
|
|---|