Skip to content

Commit dffaed3

Browse files
authored
morse: fold case bug (briandfoy#949)
* Sometimes letter case was being folded and sometimes it was not * When debugging, txt2mors() handled the folding but txt2word() needed it; both of these functions lookup values in %chartab
1 parent 20047fd commit dffaed3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/morse

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use strict;
1616

1717
use Getopt::Std qw(getopts);
1818

19-
my ($VERSION) = '1.3';
19+
my ($VERSION) = '1.4';
2020

2121
my %chartab = (
2222
0 => '-----', 1 => '.----', 2 => '..---', 3 => '...--',
@@ -93,7 +93,12 @@ sub txt2word {
9393
foreach my $c (split //, $line) {
9494
if ($c eq "\n") {
9595
print "\n";
96-
} elsif (exists $chartab{$c}) {
96+
next;
97+
}
98+
if ($c =~ m/[A-Z]/) {
99+
$c = lc $c;
100+
}
101+
if (exists $chartab{$c}) {
97102
my $w = $chartab{$c};
98103
$w =~ s/\./dit /g;
99104
$w =~ s/\-/daw /g;

0 commit comments

Comments
 (0)