#! perl -slw use strict; use List::Util qw[ reduce ]; sub uniq{ my %x; @x{@_} = (); keys %x } for my $filenum ( '00' .. '99' ) { open O, '>', "templ$filenum.txt" or die $!; for my $line ( 1 .. int( rand 10000 ) ) { my $line = 'X' x 100; for my $pos ( sort{$b <=> $a} uniq( map int( rand 100 ), 0 .. int( rand 10 ) ) ) { substr $line, $pos, 0, '{\d' . int( rand 9 ) . '}'; } print O $line; } close O; }