aboutsummaryrefslogtreecommitdiff
path: root/challenge-328/e-choroba/perl/ch-2.pl
blob: 749095d787f4cf89d966cc8b81f7f1e7d44cbb86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use warnings;
use strict;
use experimental qw( signatures );

my $bad = join '|', map "$_\u$_|\u$_$_", 'a' .. 'z';

sub good_string($str) {
    1 while $str =~ s/$bad//;
    return $str
}

use Test::More tests => 3;

is good_string('WeEeekly'), 'Weekly', 'Example 1';
is good_string('abBAdD'), '', 'Example 2';
is good_string('abc'), 'abc', 'Example 3';