for my $module (&lt;/home/ben/projects/*&gt;) {
    if (-f "$module/Makefile.PL") {
        # open file
        # Add the "META-MERGE" lines
        s/(WriteMakefile\s*\()/$1\nMETA_MERGE => /;
        # Write file
        chdir $module or die $!;
        system ("perl-reversion -bump");
        system ("perl Makefile.PL;make dist");
        system ("cpan-upload");
    }
}