#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11151867 use warnings; open my $fh, '<', 'config.file' or die; my $configlist = join '', <$fh>; close $fh; open $fh, '<', 'gamelist.txt' or die; while( <$fh> ) { chomp; (my $newfile = $configlist) =~ s/floppy0=\K/$_/; open my $outfh, '>', "$_.config" or die; print $outfh $newfile; close $outfh; } close $fh;