diff options
| author | Bob Lied <boblied+github@gmail.com> | 2024-04-30 09:44:43 -0500 |
|---|---|---|
| committer | Bob Lied <boblied+github@gmail.com> | 2024-04-30 09:44:43 -0500 |
| commit | 3ef20e322284b3c84c09826588bb7127ecdbe130 (patch) | |
| tree | 27b1afa20e67ba1037be5e9206470b531657cd04 | |
| parent | edd2ba5b02d33a2f1ae853e86980b29716fe16b1 (diff) | |
| download | perlweeklychallenge-club-3ef20e322284b3c84c09826588bb7127ecdbe130.tar.gz perlweeklychallenge-club-3ef20e322284b3c84c09826588bb7127ecdbe130.tar.bz2 perlweeklychallenge-club-3ef20e322284b3c84c09826588bb7127ecdbe130.zip | |
Week 267 add blog reference
| -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 ) |
