Fix perlcritic issues in ai.pl