- or download this
my %rules = (A => 1,B => 1,C => 0,D => 1);
my $s = 0;
while ($F[2] =~ /(\d+)([ABCD])/g) {
...
my $op = $2;
$s += $n * $rules{$op};
}
- or download this
$s - Values from D at both ends are added to the total - if D does not
+ exist at both ends in any given code, whichever D is present is adde
+d regardless (the way the code currently works)
$s1 - Only the value from D at the start of the code is added
$s2 - Only the value from D at the end of the code is added
- or download this
$s = 47 (2+40+1+4)
$s1 = 43 (2+40+1)
$s2 = 45 (40+1+4)
- or download this
$s = 43 (2+40+1)
$s1 = 43 (2+40+1)
$s2 = 41 (40+1)