From 3da4662976b697f203498b79e46e85ae8df01981 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 25 Feb 2016 17:37:18 -0500 Subject: dictionary now full, 7678 bytes free --- messages.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'messages.pl') diff --git a/messages.pl b/messages.pl index d225d17..fe94a35 100644 --- a/messages.pl +++ b/messages.pl @@ -8,7 +8,13 @@ open my $t, ") { next unless /^dict(\d\d):.*;\s*"([^"]*)"/; - my $value = 'Z' . chr($1 + 96); + my $id = $1; + if($id < 27) { + $id = chr($id + 96); + } else { + $id = chr($id - 27 + 65); + } + my $value = 'Z' . $id; my $key = quotemeta $2; $dictionary{$key} = $value; } @@ -37,12 +43,13 @@ while() { $total_in += (1 + length); my $dict_used = 0; - for my $dk (keys %dictionary) { + for my $dk (sort { length $b <=> length $a } keys %dictionary) { if(s/$dk/$dictionary{$dk}/g) { $dict_used = 1; } } + #warn "'$_'\n" if $label eq 'do_you_want'; open my $out, ">msg.out" or die $!; print $out $_; close $out; -- cgit v1.2.3