good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: The Comma Operatorby da (Friar) |
on Jul 20, 2001 at 19:24 UTC ( [id://98445]=note: print w/replies, xml ) | Need Help?? |
This is an excellent application for Deparse.
The -p parameter to Deparse gives you nearly as many parenthesis as perl can give you, which is useful for explainging things. I was first exposed to this trick by Brother MeowChow when I asked how in hell his .sig worked.
The latter arguments are thrown away because the '=' binds more tightly than the comma. If these were subroutines, they would have evaluated before being discarded. Note the parens around everything; to answer your question about why it evaluates all three terms, it is a list that gets discarded after evaluating its elements, which look like functions so they're evaluated as functions. And your description was exactly right.
In Section
Seekers of Perl Wisdom
|
|