logo       

[SPOILER] Minimalistic (but CPAN-enabled) solution: msg#00050

lang.perl.qotw.discuss

Subject: [SPOILER] Minimalistic (but CPAN-enabled) solution

Here's a solution using IO::All and the Uniq modules which implements the uniq
function:

<<<
#!/usr/bin/perl

use strict;
use warnings;
use IO::All;
use Uniq;

io($ARGV[1])->print(uniq(
sort { $a cmp $b }
map { my $s = $_; $s=~s{[A-Z]$}{M}; ($_, $s) }
io($ARGV[0])->getlines()
));
>>>

There's exactly one statement except for all the use ones.

Regards,

Shlomi Fish
--

---------------------------------------------------------------------
Shlomi Fish shlomif-ik1l9ssToec+JF/nGntIXQ@xxxxxxxxxxxxxxxx
Homepage: http://www.shlomifish.org/

Knuth is not God! It took him two days to build the Roman Empire.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise