Maybe using a generic regexp, then checking against %SUBS would be better? That eliminates a nested loop and multiple regexp compilations.
foreach my $line ( @sub_code ) { if ( $line =~ /(\w+)\(/ ) { if ( exists $SUBS{$1} ) { push( @subs, $1 ); } } }
Note: I assumed %SUBS keys are subroutine names, not regexps.
In reply to Re: Slow Regex - How to Optimize
by ikegami
in thread Slow Regex - How to Optimize
by noslenj123
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |