Perl extension to reduce boilerplate in shell scripts