Nov 1, 2004, 10:53 AM
Post #3 of 3
Think about what is actually passed to "print" in each case.
Re: [Larkdog] why the difference?
[In reply to]
In the first case "print" gets three arguments. When "print" gets multiple arguments then it prints them separated by the contents of the variable $,. The default value for $, is an empty string, but you can change that.
In the second case "print" gets one argument which is the results of interpolating an array in a double quoted string. When an array is interpolated in a double quoted string, the individual elements are separated by the contents of the $" variable. The default value of $" is a single space but, once again, you can change it.
I cover this in more detail in this article.
Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks