## Posted By

cmm7825 on 06/19/10

# Problem 17

/ Published in: Perl

`#!/usr/bin/perl use strict;use warnings; my \$sum = 0; for my \$i (1..1000){   if(\$i == 1000){        \$sum += 11;}   if(\$i =~ m/\d*(\d)\d\d\$/){        if(\$1 == 1 || \$1 == 2 || \$1 == 6) { \$sum += 13; }        if(\$1 == 4 || \$1 == 5 || \$1 == 9) { \$sum += 14; }        if(\$1 == 7 || \$1 == 8 || \$1 == 3) { \$sum += 15; }   }   if(\$i =~ m/^\d00\$/){        \$sum -= 3;   }   if(\$i =~ m/\d*(\d)\d\$/){        if(\$1 == 2 || \$1 == 3 || \$1 == 8 || \$1 == 9) { \$sum += 6; }        if(\$1 == 4 || \$1 == 5 || \$1 == 6) { \$sum += 5; }        if(\$1 == 7) { \$sum += 7; }   }   if(\$i =~ m/\d*1(\d)\$/){        if(\$1 == 0) { \$sum += 3; }        if(\$1 == 1 || \$1 == 2) { \$sum += 6; }        if(\$1 == 5 || \$1 == 6) { \$sum += 7; }        if(\$1 == 3 || \$1 == 4 || \$1 == 8 || \$1 == 9) { \$sum += 8; }        if(\$1 == 7) { \$sum += 9; }   }   elsif(\$i =~ m/\d*(\d)\$/){        if(\$1 == 1 || \$1 == 2 || \$1 == 6) { \$sum += 3; }        if(\$1 == 4 || \$1 == 5 || \$1 == 9) { \$sum += 4; }        if(\$1 == 7 || \$1 == 8 || \$1 == 3) { \$sum += 5; } }} print "\$sum\n";`