Fix perlcritic issues in apm.pl