|
[SPOILER] Minimalistic (but CPAN-enabled) solution: msg#00050lang.perl.qotw.discuss
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> |
|---|---|---|
| Previous by Date: | [SPOILER] Perl 'Easy' Quiz of the Week #2005-1: 00050, Luke Triantafyllidis |
|---|---|
| Next by Date: | Next Quiz: 00050, Shlomi Fish |
| Previous by Thread: | [SPOILER] My Solutions to the Problemi: 00050, Shlomi Fish |
| Next by Thread: | Next Quiz: 00050, Shlomi Fish |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |