1 2 tt # the first two are the sequence from the doc 2 3 aa 1 tt -> 1-1 tt 2 tt -> 1-2 tt 3 aa -> 2-1 aa #and so on I will give you my code (but i dont think it will help :/ ) #!/usr/bin/perl\ open FH "<", "filename.txt" or die $!; open FHWRITE, ">>results.txt" or die $!; $seq1 = #dont know how for the $ to take the value of the first seq1 $countnumb = split (' ',); # dont know how to take the second number for count number but i think its whit split $count =0; while ($count ne $countnumb) { print "$seq1"; $count++; } # i dont know when this finishes how to make it go for the second seq