Perl - remove unused code