in reply to piping to lp is broken after perl upgrade

I don't see an issue in the code you've shown except that you're not using strictures (use strict; use warnings;). It wouldn't surprise me a great deal to find that there is something that was waiting in your heredoc to bite and has now bitten. It may help if you:

my $prolog = << 'ENDPROLOG';

so interpolation doesn't happen.

True laziness is hard work