my $x = 1; while(1) { my $text = "a" x $x; $text =~ s/(\w+){$x}//; print "x = $x ; OK\n"; $x++; }