# from Jenda Krynicky
# on Saturday 24 November 2007 17:00:

>I mean ... WHY would anyone want to write
>
>  print L(qw(a b c))->map(sub {"|$_|"})->join(' '), "\n";
>
>instead of
>
>  print join( ' ', map {"|$_|"} qw(a b c)), "\n";

It is a flow from left to right rather than right to left.  Each method 
returns a list object, so extra map()s, grep()s, and etc just get 
appended to the right -- as opposed to jumping back to the beginning of 
the construct to add another transformation (and then messing with more 
parenthesis.)

>(or in this particular case
>  print "|", join( '| |', qw(a b c)), "|\n";
>)?

Well, that would be bad practice because you've repeated your separator 
character and de-normalized the expression.  If you just don't like the 
example, feel free to write a better one.

--Eric

Reply via email to