I'm impressed by how well parts of your code foil Perl::Tidy. The "@{[...]}" and s{}{...}e notation and the __END__ at the end of a line all cause Perl::Tidy not to respace those sections of code at all. The following modification is Perl::Tidy-friendlier: