in reply to Can I get some help with a regex please

There is nothing in regexp or substitution syntax that would do this without using additional perl code as in choroba's example. Is there any particular reason you want a regexp for this?

In normal perl code, you will usually find that joining a bunch of smaller strings in one go is faster than repeatedly appending:

$block = join '', map "$_ cat\nman\n", 1 .. $n;