add perl implementation
Merge pull request #1 from oblique/add_perl_script

Added Perl implementation and a test script for it.