aboutsummaryrefslogtreecommitdiff
path: root/challenge-079
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-10-03 19:28:07 +0100
committerGitHub <noreply@github.com>2020-10-03 19:28:07 +0100
commitfb2f69506d69bb49d597f8e3efac51f0664e6970 (patch)
tree08a998e641ea3f328cbe7cf508179a555c44aa53 /challenge-079
parent8b0fe4735982fe73259bd673893809550af9cc21 (diff)
parenta74b011c003088e35b77f3a5d646f501794f7f9e (diff)
downloadperlweeklychallenge-club-fb2f69506d69bb49d597f8e3efac51f0664e6970.tar.gz
perlweeklychallenge-club-fb2f69506d69bb49d597f8e3efac51f0664e6970.tar.bz2
perlweeklychallenge-club-fb2f69506d69bb49d597f8e3efac51f0664e6970.zip
Merge pull request #2439 from boblied/master
Solutions for PWC 080
Diffstat (limited to 'challenge-079')
-rw-r--r--challenge-079/bob-lied/perl/lib/CountSetBit.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/challenge-079/bob-lied/perl/lib/CountSetBit.pm b/challenge-079/bob-lied/perl/lib/CountSetBit.pm
index 1733d4e676..068be81e2a 100644
--- a/challenge-079/bob-lied/perl/lib/CountSetBit.pm
+++ b/challenge-079/bob-lied/perl/lib/CountSetBit.pm
@@ -1,3 +1,4 @@
+## Please see file perltidy.ERR
# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu:
#=============================================================================
# CountSetBit.pm
@@ -17,18 +18,17 @@ use feature qw/ signatures /;
no warnings qw/ experimental::signatures /;
require Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw();
+our @ISA = qw(Exporter);
+our @EXPORT = qw();
our @EXPORT_OK = qw();
-sub new($class, $n)
+sub new ( $class, $n )
{
$class = ref($class) || $class;
my $self = {
_n => $n,
- _sum => 0,
- };
+ _sum => 0, };
bless $self, $class;
return $self;
}
@@ -40,14 +40,14 @@ sub run($self)
return ( $self->{_sum} % 1000000007 );
}
-sub _bitsOf($self, $n)a
+sub _bitsOf ( $self, $n )
{
my $count = 0;
while ( $n > 0 )
{
$count++;
- $n = $n & ($n-1);
+ $n = $n & ( $n - 1 );
}
return $count;
}