As you've pointed out, the comma is the list operator.
What do you mean by that? Commas can construct lists, but only in list context. Commas in scalar context don't. Witness:
#!/usr/bin/perl use strict; use warnings; sub context { print wantarray ? "LIST\n" : "SCALAR\n" } my @a = (context, context); my $a = (context, context); __END__ LIST LIST SCALAR SCALAR
Abigail
In reply to Re: dot '.', comma ',' operators "oops" & "huh?"
by Abigail-II
in thread dot '.', comma ',' operators "oops" & "huh?"
by chunlou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |