in reply to Slow Regex - How to Optimize
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 Section
Seekers of Perl Wisdom