diff options
| author | LoneWolfiNTj <Hatley.Software@gmail.com> | 2023-01-22 13:34:15 -0800 |
|---|---|---|
| committer | LoneWolfiNTj <Hatley.Software@gmail.com> | 2023-01-22 13:34:15 -0800 |
| commit | e80e6616a02316cde8aec2c9dba70d9a833a6d42 (patch) | |
| tree | 26ff4ad05170c999a51c1031b61b042f77b82ed4 | |
| parent | a51df1084746b8933569ba2cc60244ba5f2da816 (diff) | |
| download | perlweeklychallenge-club-e80e6616a02316cde8aec2c9dba70d9a833a6d42.tar.gz perlweeklychallenge-club-e80e6616a02316cde8aec2c9dba70d9a833a6d42.tar.bz2 perlweeklychallenge-club-e80e6616a02316cde8aec2c9dba70d9a833a6d42.zip | |
Simplified mask.
| -rwxr-xr-x | challenge-200/robbie-hatley/perl/ch-1.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/challenge-200/robbie-hatley/perl/ch-1.pl b/challenge-200/robbie-hatley/perl/ch-1.pl index 19dab4fd9b..99f752f39b 100755 --- a/challenge-200/robbie-hatley/perl/ch-1.pl +++ b/challenge-200/robbie-hatley/perl/ch-1.pl @@ -48,7 +48,7 @@ sub get_arith_slices($array_ref){ foreach my $mask (@masks){ # For each possible mask, my @slice = (); # create a slice. for ( my $idx = 0 ; $idx <= $#array ; ++$idx ){ # For each index in @array, - my $yesno = ($mask/2**($idx))%2; # examine corresponding binary digit in mask, + my $yesno = ($mask/2**$idx)%2; # examine corresponding binary digit in mask, if ($yesno) {push @slice, $array[$idx]}} # and do-or-don't include $array[$idx] in @slice, push @slices, \@slice;} # depending on whether digit is 0 or 1. foreach my $slice_ref (@slices){ # But only return slices that are arithmetic. |
