blob: 8323c7b2277cdc297d9954fb8fc1e397615bd14b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env perl
# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu:
#=============================================================================
# ch-1.pl
#=============================================================================
# Copyright (c) 2020, Bob Lied
#=============================================================================
# Perl Weekly Challenge 080 Task #1 > Smallest Positive Number
#=============================================================================
# You are given unsorted list of integers @N.
# Write a script to find out the smallest positive number missing.
use strict;
use warnings;
use v5.30;
use feature qw/ signatures /;
no warnings qw/ experimental::signatures /;
use Getopt::Long;
use lib "lib";
use SmallestPositive;
sub Usage { "Usage: $0 args" };
my $Verbose = 0;
GetOptions('verbose' => \$Verbose);
# Allow anything that looks like a list as arguments
(my $argv = "@ARGV") =~ s/[,()]/ /g;
my @N = split(" ", $argv);
die "Usage: $0 list-of-integers" unless @N;
my $task = SmallestPositive->new(\@N);
my $result = $task->run();
say $result;
|