On Sep 22, 2004, at 9:41 PM, Jeffrey Ferland wrote:
#two simple arrays
@x = (1,2,4,8);
@y = (2,4,8,16);
#print both arrays with values joined by "," - end with a newline.
print (join',',@x), "\n";
print (join',',@y), "\n";
#print colinear check math
print ((($y[0]-$y[1]) * ($x[0]-$x[2])) - (($y[0]-$y[2]) *
($x[0]-$x[1]))), "\n";
If you add the "-w" switch, there are some clues to what is going on.
print (...) interpreted as function at /tmp/foo line 5.
print (...) interpreted as function at /tmp/foo line 6.
print (...) interpreted as function at /tmp/foo line 8.
Useless use of a constant in void context at /tmp/foo line 5.
Useless use of a constant in void context at /tmp/foo line 6.
Useless use of a constant in void context at /tmp/foo line 8.
This section of the perlfunc man page is a little more explicit.
Any function in the list below may be used either with or without
parentheses around its arguments. (The syntax descriptions omit the
parentheses.) If you use the parentheses, the simple (but occasionally
surprising) rule is this: It looks like a function, therefore it is a
function, and precedence doesn't matter. Otherwise it's a list opera-
tor or unary operator, and precedence does matter. And whitespace
between the function and left parenthesis doesn't count--so you need to
be careful sometimes:
print 1+2+4; # Prints 7.
print(1+2) + 4; # Prints 3.
print (1+2)+4; # Also prints 3!
print +(1+2)+4; # Prints 7.
print ((1+2)+4); # Prints 7.
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm