No subject


Tue Jun 4 12:17:20 MDT 2013


       %s (...) interpreted as function
           (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.

You can also get this by using the "use diagnostics;", IIRC.

There are examples (with varying degrees of complexity and realism) in
the referenced "perlop" man page, but the basic reason for this
warning is typified by this code:

   print ($f-32)*5/9, "\n";

You probably want this to be processed as:

   print( ($f-32)*5/9, "\n");

But perl decides (for reasons outlined in perlop) that what you really
meant was:

   print( ($f-32) )*5/9, "\n";

In action:

| $ perl -wle '$f = 72; print ($f-32)*5/9, "\n";'
| print (...) interpreted as function at -e line 1.
| Useless use of division (/) in void context at -e line 1.
| Useless use of a constant in void context at -e line 1.
| 40
| $ perl -wle '$f = 72; print( ($f-32)*5/9, "\n" );'
| 22.2222222222222
| 
| $

t.



More information about the LUG mailing list