fixes for new DDG (using strict)

master
Michael Smith 2012-05-01 21:26:43 -06:00
parent fbff1c8f31
commit f7cd676c95
4 changed files with 9 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
DDG-*
.build
*.sw*

View File

@ -21,7 +21,7 @@ handle query_lc => sub {
}
if(scalar(@dates) == 6) {
my $inclusive, $days1, $days2;
my ($inclusive, $days1, $days2);
eval {
$days1 = Date_to_Days(@dates[2,0,1]);

View File

@ -91,16 +91,16 @@ handle remainder => sub {
my @string = split(//,reverse $_);
my $flippedString;
foreach $char (@string) {
for (@string) {
# Not all uppercase letters can be flipped
$char = lc($char);
$_ = lc;
if ( exists $charMap{$char}) {
$flippedString .= $charMap{$char};
if ( exists $charMap{$_}) {
$flippedString .= $charMap{$_};
}
else {
$flippedString .= $char;
$flippedString .= $_;
}
}
return $flippedString;

View File

@ -15,7 +15,7 @@ handle query_parts => sub {
my @allwords = share('words.txt')->slurp;
my @words;
foreach (@allwords) {
for (@allwords) {
chomp($_);
if (length($_) == $length) { push(@words, $_); }
}
@ -24,7 +24,7 @@ handle query_parts => sub {
my @randomwords;
if (scalar(@words) > 30) {
while (scalar(@randomwords) < 30) {
$rand = int(rand(scalar(@words)));
my $rand = int(rand(scalar(@words)));
if ($words[$rand]) {
push(@randomwords, $words[$rand]);
$words[$rand] = 0;