I want to minify a perl script so that I can detect practically identical perl scripts that have only differences in line comments, blank lines, etc. I there a pre-built script to do this minification? If so, I would be able to checksum and highlight the identical files on my own.
Not exactly minifying, but you can use B::Deparse
to compile a Perl script, then decompile it back to Perl.
You can diff the results.
A simple command line example follows:
david@Workstation:comp # perl -MO=Deparse 1.pl > a.pl
1.pl syntax OK
david@Workstation:comp # perl -MO=Deparse 2.pl > b.pl
2.pl syntax OK
david@Workstation:comp # diff a.pl b.pl
david@Workstation:comp # diff 1.pl 2.pl
3c3,5
< say "Hello";
---
>
>
> say "Hello";
david@Workstation:comp #
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With