in reply to Re: dot '.', comma ',' operators "oops" & "huh?"
in thread dot '.', comma ',' operators "oops" & "huh?"
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |