With the Log::Reproducible module

Just add a single line near the top of your Perl script before accessing @ARGV, calling a module that manipulates @ARGV, or processing command line options with a module like Getopt::Long:

use Log::Reproducible;

That's all!

Now, every time you run your script, the command line options and other arguments passed to it will be archived in a simple YAML-formatted log file whose name reflects the script and the date/time it began running.

With the perlr wrapper

Can't or don't want to modify your script?

When you install Log::Reproducible, a wrapper program called perlr gets installed in your $PATH. Running scripts with perlr automatically loads Log::Reproducible even if your script doesn't.

perlr script-without-log-reproducible.pl