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.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^6: Stop Using Perl
by LanX (Saint) on Jan 02, 2015 at 00:00 UTC
    > This is bull

    bull like in "red bull" ?

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

      bull like in "red bull" ?

      *blush* well... more like bull => 'sh*t', but then, hey! maybe more like this bull for redundancy...

      qwurx [shmem] ~ > perl -le '%h=qw(Buffalo buffalo Buffalo buffalo buff +alo buffalo Buffalo buffalo);print"$_ => $h{$_}" for keys %h' Buffalo => buffalo buffalo => buffalo
      Sorry for any offense.

      update: added meaningful code to be explored
      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      t