scripts: rewrite git commit-msg hook in Perl