Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Perl 6 implementation of the following Perl 5 code

by moritz (Cardinal)
on May 28, 2013 at 05:26 UTC ( #1035525=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Perl 6 implementation of the following Perl 5 code
in thread Perl 6 implementation of the following Perl 5 code

If you make the commas stand out by putting them up front, it looks untidy, yes. As they say, the key is to play to Perl's strengths, not to its weaknesses.

And if you include unnecessary punctuation, it also looks untidy. This one seems to work fine:

use v6; say reverse .words for map *[1], sort map { [.words[*-1],$_] }, grep /SRC1/, lines;


Comment on Re^3: Perl 6 implementation of the following Perl 5 code
Download Code
Re^4: Perl 6 implementation of the following Perl 5 code
by konnjuta (Acolyte) on May 28, 2013 at 07:23 UTC

    I can confirm this works and Infact its actually much cleaner for people who likes one-liner

    say reverse .words for map *[1], sort map {[.words[*-1],$_]}, grep /ICSE/, lines;

    Hmm ... now I'm wondering why I couldn't get the sort to work without the parenthesis previously.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-08-28 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls