diff options
| -rw-r--r-- | challenge-258/bob-lied/perl/ch-1.pl | 2 | ||||
| -rw-r--r-- | challenge-258/bob-lied/perl/ch-2.pl | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/challenge-258/bob-lied/perl/ch-1.pl b/challenge-258/bob-lied/perl/ch-1.pl index 7d3ec46624..f3cde7a3a4 100644 --- a/challenge-258/bob-lied/perl/ch-1.pl +++ b/challenge-258/bob-lied/perl/ch-1.pl @@ -26,7 +26,7 @@ my $DoTest = 0; GetOptions("test" => \$DoTest, "verbose" => \$Verbose); exit(!runTest()) if $DoTest; -say cedn(@ARGV); +say cedn( map { s/[^0-9]//gr } @ARGV); sub cedn(@ints) { diff --git a/challenge-258/bob-lied/perl/ch-2.pl b/challenge-258/bob-lied/perl/ch-2.pl index 43224f6011..ff86c6e2c7 100644 --- a/challenge-258/bob-lied/perl/ch-2.pl +++ b/challenge-258/bob-lied/perl/ch-2.pl @@ -28,12 +28,14 @@ use v5.38; use builtin qw/true false/; no warnings "experimental::builtin"; use Getopt::Long; -my $Verbose = 0; +my $K = 0; my $DoTest = 0; -GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +GetOptions("test" => \$DoTest, "k:i" => \$K); exit(!runTest()) if $DoTest; +say sumOfVal($K, @ARGV); + sub hasKones($k, $n) { return ( sprintf("%b", $n) =~ tr/1/1/) == $k; |
