aboutsummaryrefslogtreecommitdiff
path: root/challenge-280/kjetillll/perl/ch-2.pl
blob: afc5b87f934a56a07708919f37c3f5eccfd19fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
use strict; use warnings; use Test::More tests=>3;

sub count {
    local $_ = shift;
    s/ \| .*? \| //xg;
    y/*//
}

is count( $$_{input} ) => $$_{output}
    for { input => "p|*e*rl|w**e|*ekly|",           output => 2 },
        { input => "perl",                          output => 0 },
        { input => "th|ewe|e**|k|l***ych|alleng|e", output => 5 }