Put dense DRY perl oneliner into a separate, more readable perl script