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

use strict;
use warnings;
use feature 'say';
use experimental 'signatures';

use List::Util 'any';

sub main (@ints) {
    my $start    = pop(@ints);
    my $solution = $start;

    while ( any { $solution == $_ } @ints ) {
        $solution *= 2;
    }

    say $solution;
}

main(@ARGV);