in reply to Regexp matching on a multiline file: dealing with line breaks

Thank you for letting us know you cross posted; please include the link next time.

In this case, I will assume you are loading the entire file into memory; if you are not, you will need to work with "strange buffers and things like that". It looks like your format has no whitespace dependence, so one easy way to do it is to allow arbitrary whitespace in your regex:

/k\s*i\s*t\s*t\s*e\s*n/;
which could be written more maintainably as:
my $string = 'kitten'; my $regex = join '\s*', split //, $string; /$regex/;

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.