in reply to Re^4: Stop Using Perl
in thread Stop Using Perl
More to the point: the fat comma particularities apply to the LHS in any expression. The fat comma is just a comma. A comma in list context... yadda yadda, I won't expand that further. The RHS of a fat comma is already in list context, if the (fat) comma is a list operator.
qwurx [shmem] ~ > perl -le 'sub f{qw(foo bar baz)}$_=(f=>f);print' baz qwurx [shmem] ~ > perl -le 'sub f{qw(foo bar baz)}@_=(f=>f);print"@_"' f foo bar baz
That's easy. Introducing scalar context to the RHS of the fat comma is just quirky IMHO.
Why should it be too hard to grasp that an array (or a function return which yields a list) expands into a list in list context?
The context isn't fixed by the top statement which is the list-assignment to %hash . That's why you can easily write DB<103> sub func { return 3,4,5 } DB<104> $href = {a => scalar func(), b => "x" } => { a => 5, b => "x" }
This is bull. The scalar in there does what? There.
In my book, the context of the (finally discarded) last value of an assignment is set up by the LHS. But then, I might be entirely wrong about context in perl.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Stop Using Perl
by LanX (Saint) on Jan 02, 2015 at 00:00 UTC | |
by shmem (Chancellor) on Jan 02, 2015 at 00:11 UTC |