[Israel.pm] 2 Qs on assignment and evaluation

Scott Weisman sweisman at pobox.com
Thu Jan 29 07:59:27 PST 2004


I also had a hard time understanding what was going on, until I remember that
a comma-separated list passed to print() is really an array:

my @array = ($a=2, $a++, "\n");
print @array;

Looked at from this perspective, it makes perfect sense.

Of course, if you do it like this (which is also more C-like):

print ($a = 2) . $a++ . "\n";

You would probably get the expected output (I haven't tried though).

Scott



More information about the Perl mailing list