3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Remove unnecessary blank lines

This commit is contained in:
Pragmatic Software 2018-02-18 18:33:07 -08:00
parent bc3e687c27
commit d70fa55174

View File

@ -2,11 +2,9 @@
use warnings; use warnings;
use strict; use strict;
use JSON; use JSON;
my $file = 'cat_questions'; my $file = 'cat_questions';
open my $fh, '<', $file or die "$file: $!"; open my $fh, '<', $file or die "$file: $!";
my $q = { questions => [] }; my $q = { questions => [] };
@ -15,17 +13,12 @@ my $id = 0;
foreach my $line (<$fh>) { foreach my $line (<$fh>) {
chomp $line; chomp $line;
print STDERR "<$line>\n"; print STDERR "<$line>\n";
$id++; $id++;
my ($category, $question, @answers) = split /`/, $line; my ($category, $question, @answers) = split /`/, $line;
my $answer = shift @answers; my $answer = shift @answers;
my $h = { category => $category, question => $question, answer => $answer, alternativeSpellings => \@answers, suggestions => [], id => $id }; my $h = { category => $category, question => $question, answer => $answer, alternativeSpellings => \@answers, suggestions => [], id => $id };
push @{$q->{questions}}, $h; push @{$q->{questions}}, $h;
} }
my $json = encode_json $q; my $json = encode_json $q;
print "$json\n"; print "$json\n";