my %tval; open(IN, "test.out") || die "\nCan't open test.out\n $!\n"; while() { if(//) { for ($count = 1; $count <= $1; $count++) { print OUT "\n"; } } print OUT; } close(IN); close(OUT);