in reply to Can I get some help with a regex please
A regex pattern defines a set of strings. In theory, it would be possible to generate the set of strings a regex pattern defines, achieving what you want. There's no means to do that in core Perl, but there might a module to do this.
Update: No, there's really simple pattern that define a set containing just the desired string. I was thinking of something like qr/^(?:cat\nman\n){$n}\z/, but that's not correct.
I'm not sure if it exists as a module because it's not really a solution to any problem. Regex weren't designed to compose strings. With that in mind, I'll leave you with the following two alternatives:
Silly regex-based solution:
join "", map s/\z/ cat\nman\n/r, 1..$n
But that's just an expensive version of
join "", map "$_ cat\nman\n", 1..$n
|
---|