in reply to Re^2: processing file content as string vs array
in thread processing file content as string vs array

I think the loopy approach discussed by haukex and others is probably better than using regexes in this application. However...

if( $file_content =~ m/(.*?\@user_info_start.*?\n)(.*)(.*?\@user_info_end.*$)/si){ ... }

Some comments on this regex. (BTW: This is all untested.)

Here's an untested suggestion for a whole-file info block extraction regex. It assumes:

if ($file_content =~ m{ \@user_info_start \s* \n (.*?) \n [^\n]*? \@us +er_info_end (?! \S) }xms) { my $user_info = $1; ... }
(Note that the info block will be extracted without an ending newline.) If you have time to play around with this, I'd be interested to know how this regex compares speedwise to the loopy solutions.

Give a man a fish:  <%-{-{-{-<