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

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

sub main (@ints) {
    my @solution = ();
    for my $i (@ints) {
        if ($i == 0) {
            # Duplicate the zero
            push @solution, 0;
        }
        push @solution, $i;
    }
    say join(', ', @solution[ 0 .. $#ints ]);
}

main(@ARGV);