From 8a7e0c098e6971515c121ed61cd3d773f3b32cdb Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 20 Mar 2023 10:54:53 +0000 Subject: Create ch-1.pl --- challenge-209/james-smith/perl/ch-1.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 challenge-209/james-smith/perl/ch-1.pl diff --git a/challenge-209/james-smith/perl/ch-1.pl b/challenge-209/james-smith/perl/ch-1.pl new file mode 100644 index 0000000000..98ddd16e71 --- /dev/null +++ b/challenge-209/james-smith/perl/ch-1.pl @@ -0,0 +1,19 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use feature qw(say); +use Test::More; +use Benchmark qw(cmpthese timethis); + +my @TESTS = ( + [ [1,0,0] => 1 ], + [ [1,1,1,0] => 0 ], + [ [1,1,1] => -1 ], +); + +sub special_bit_chars { + return -1 if $_[-1]; + ($_[0]&&shift),shift until @_<2; + scalar @_ +} -- cgit