aboutsummaryrefslogtreecommitdiff
path: root/challenge-258/dave-jacoby/perl/ch-1.pl
blob: e9152964bac50d0af8dfea59fe47a1226d7a93e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl

use strict;
use warnings;
use experimental qw{ say postderef signatures state };

my @examples = (

    [ 10,  1, 111, 24, 1000 ],
    [ 111, 1, 11111 ],
    [ 2,   8, 1024, 256 ],
);

for my $example (@examples) {
    my $output = scalar grep { ( length $_ ) % 2 == 0 } $example->@*;
    my $ints   = join ', ', $example->@*;

    say <<~"END";
    Input:  \@ints = ($ints)
    Output: $output
    END
}