Miscellaneous hacks written in Perl