From 88c67bdde02feaec0dee0c7d7f091c5bf937c0a8 Mon Sep 17 00:00:00 2001 From: Alexander Pankoff Date: Tue, 29 Sep 2020 13:58:07 +0200 Subject: add perl solution for wk-080 ch-1 --- challenge-080/alexander-pankoff/perl/ch-1.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-080/alexander-pankoff/perl/ch-1.pl diff --git a/challenge-080/alexander-pankoff/perl/ch-1.pl b/challenge-080/alexander-pankoff/perl/ch-1.pl new file mode 100644 index 0000000000..d6ef9089ee --- /dev/null +++ b/challenge-080/alexander-pankoff/perl/ch-1.pl @@ -0,0 +1,18 @@ +#!/usr/bin/env perl +use v5.20; +use utf8; +use strict; +use warnings; +use autodie; +use feature qw(say signatures); +no warnings 'experimental::signatures'; + +use List::Util qw(first); + +say smallest_positive_number_missing(@ARGV); + +sub smallest_positive_number_missing( @xs) { + my %lookup = map { $_ => 1 } @xs; + return first { !$lookup{$_} } 1 .. ( @xs + 1 ); +} + -- cgit