On Jul 29, perl.org said:

>> It's
>> easier to read that code bottom to top, so let's start with:
>>
>> map { m/\.([^.]+)$/ ? [$_, $1] : [$_, ''] } @input;
>
>Unfortunately I really don't find this easy to read.

That's why he broke it down.  Is the map() really the problem, or is it
the regex, the ?: operator, and the two array references?

>I like the convenient functionality, but I don't like the syntax.  I don't
>understand why there is no between logic and @data here:
>
>print join( $/, sort( { $a <=> $b } @data ));

I'm not sure I understand YOU.  Did you mean "... why there is COMMA
between THE SORT logic and @data here:"?  That makes more sense.

The reason there's no comma is because Perl's grammar says you don't put
commas after blocks like that.

  map  BLOCK LIST
  grep BLOCK LIST
  sort BLOCK LIST

cf.:

  map  EXPR, LIST
  grep EXPR, LIST

-- 
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to