in reply to Performance of assambled regex

I would suspect that the problem is due to the fact that your code has to recompile the regex each time through the loop.

Perhaps using the o modifier would help:

while(<$fh_big_file>) { print if (/MY_HUGE_REGEX_JUST_PLAIN/../^END_OF_BLOCK/o); }
Update: or rather:
while(<$fh_big_file>) { print if (/MY_HUGE_REGEX_JUST_PLAIN/o .. /^END_OF_BLOCK/); }
Update 2: sorry, wrong copy and paste (and thanks to shmem for pointing out):
while(<$fh_big_file>) { print if (/$regex/o .. /^END_OF_BLOCK/); }

Replies are listed 'Best First'.
Re^2: Performance of assambled regex
by shmem (Chancellor) on Jul 26, 2015 at 12:58 UTC

    It is the $regex which gets recompiled.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'