DEV Community

loading...

Discussion on: Daily Challenge #66- Friend List

Collapse
choroba profile image
E. Choroba

Perl solution:

#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };

my $in = 'Fred:Corwill;Wilfred:Corwill;Barney:Tornbull;Betty:Tornbull;Bjon:Tornbull;Raphael:Corwill;Alfred:Corwill';

say join "",
    map "($_->[1], $_->[0])",
    sort { $a->[1] cmp $b->[1] || $a->[0] cmp $b->[0] }
    map [split /:/],
    split /;/,
    uc $in;