in reply to Doubley surprised by fat commas
Similar to parv's comment: A function argument list is a list (and assigned to the magical @_ array), and Perl flattens lists.
(Update: Same results under Strawberry 5.30.3.1 (64).)Win8 Strawberry 5.8.9.5 (32) Wed 06/09/2021 17:59:05 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings use Data::Dump qw(dd); sub fun { dd \@_; } fun('foo'); fun('foo',,,,,,,,); # fun(,,,,,,,,'foo'); # syntax error! # fun(,'foo'); # syntax error! fun('foo','bar'); fun('foo',,,,,,,'bar'); fun('foo' => => => => => => 'bar'); ^Z ["foo"] ["foo"] ["foo", "bar"] ["foo", "bar"] ["foo", "bar"]
Update: Note that fun( => 'foo') is also a syntax error.
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. |
|---|