diff options
| -rw-r--r-- | challenge-267/bob-lied/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-267/bob-lied/perl/ch-2.pl | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/challenge-267/bob-lied/blog.txt b/challenge-267/bob-lied/blog.txt new file mode 100644 index 0000000000..0f8e323e85 --- /dev/null +++ b/challenge-267/bob-lied/blog.txt @@ -0,0 +1 @@ +https://dev.to/boblied/pwc-267-positively-perl-street-5390 diff --git a/challenge-267/bob-lied/perl/ch-2.pl b/challenge-267/bob-lied/perl/ch-2.pl index 6ffd7ce7a3..4136446e0c 100644 --- a/challenge-267/bob-lied/perl/ch-2.pl +++ b/challenge-267/bob-lied/perl/ch-2.pl @@ -34,7 +34,9 @@ use Getopt::Long; my $Verbose = 0; my $DoTest = 0; -use constant MAXLINE => 100; +use constant { MAXLINE => 100, + ORD_A => ord('a') + }; GetOptions("test" => \$DoTest, "verbose" => \$Verbose); exit(!runTest()) if $DoTest; @@ -55,7 +57,7 @@ sub lineCount($str, @widths) my $width = 0; # Work with character widths, actual characters don't matter - my @cw = map { $widths[ ord($_) - ord("a") ] } split(//, $str); + my @cw = map { $widths[ ord($_) - ORD_A ] } split(//, $str); while ( defined(my $w = shift @cw) ) { if ( $width + $w <= MAXLINE ) |
