On Wed, Sep 22, 2004 at 09:41:47PM -0400, Jeffrey Ferland wrote:
> Code:
> #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";
> 
> Output:
> [EMAIL PROTECTED] ~]$ perl numtest.pl
> 1,2,4,82,4,8,[EMAIL PROTECTED] ~]$

Unexpected but documented behavior.
The bottom of the first screenful of perlfunc has this to say:

       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.


I know it's off-topic, uncalled for, and a stylistic issue to boot,
but I have a couple of comments that I hope you'll find useful:

1. use spaces
2. use qw

-Gyepi
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to