http://qs321.pair.com?node_id=1233681

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I have file contains some meta data, I need to capture few details(user information) which falls anywhere in the file. To capture that what I did was I read the entire file content as string, and used regex (m/\@user_info_start(.*)\@user_info_end/si) to capture the user details. It works fine for smaller files, but takes time for file sizes more than 1MB.

To fix this, I read the file content into an array and looped to capture the user details falls between @user_info_start and @user_info_end lines. It makes the results better than using regex for bigger files.

I just want to check with you people, like processing file content from array is best option vs regex?


All is well. I learn by answering your questions...