Implementing your algorithm as a module for your own use can be very easy. Bundling that module into a package suitable for upload to CPAN can be challenging, especially your first module. There are tools to help you build, document, test, install, and update your module suitable for upload. Upload to CPAN is optional. Building all your modules this way makes them easier to use and to update. Unfortunately this tool set has a rather steep learning curve. The best introduction I have found is in the book "Intermediate Perl".
Start with the algorithm you already have. Save your updates until you are more comfortable with the build process.