#! perl
use strict;
use warnings;
my $str1 = "I'm not unsure that it isn't impossible to " .
"avoid not including more negations without " .
"having to avoid a lack of not trying.";
my $str2 = $str1;
my %negs = ("not un" => "",
"it isn't im" => "it's ",
"avoid not including" => "include",
"without having to avoid" => "by",
"a lack of not" => "");
# Collapse double negatives
while (my ($key, $value) = each %negs)
{
$str2 =~ s/$key/$value/g;
}
# Remove extra spaces
$str2 =~ s/\s+/ /g;
# Display the translation
print "$str1\n\n-->\n\n$str2\n";
(Is there anything Perl can’t do?)
Athanasius <°(((>< contra mundum
|