BEGIN { for (ii = 1; ii < 10; ii++) { for (jj = 9; jj > 0; jj--) { print "s/."jj,ii"/"jj+ii"/;"; print "s/."ii,jj"/"jj+ii"/;"; } } }