#!/home/ben/software/install/bin/perl use warnings; use strict; use utf8; use FindBin '$Bin'; use File::Slurper qw/read_text write_text/; if (! @ARGV) { usage (); } for my $file (@ARGV) { if (! -f $file) { warn "No such file '$file'"; next; } my $text = read_text ($file); my $pod = ''; while ($text =~ s!(^=(head|encoding|pod).*?)=cut$!!sm) { $pod .= "$1\n"; } my $podout = "$file.pod.$$"; my $pmout = "$file.pm.$$"; write_text ($pmout, $text); write_text ($podout, $pod); } exit; sub usage { print < The output is the name of the files with a random number attached. EOF }