Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
According to perlop POD, "." an additive operator concatenates two strings, whereas comma operator "," in "scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value." Yeah, but what is your point? None of your examples use the comma operator in scalar context.
In practice, a lot of people use "." and "," interchangeably. Actually, they don't, because in most cases, they lead to totally different things. About the only places where they are used more or less interchangeably are as arguments to functions, where the function concatenates all its arguments. print, warn and die are the most noteworthy. But here we talk about the comma as a list constructor, where the operator is in list context. Here the difference between the comma and the dot operators is that the comma operator gives list context to its operands, where the dot operator gives scalar context to its operands. Abigail In reply to Re: dot '.', comma ',' operators "oops" & "huh?"
by Abigail-II
|
|