in reply to Speed of Perl Regex Engine
You said you build the regex and pass it to the program as a parameter ... how do you use it then?
my $regexp = @ARGV[1]; ... next if ($global =~ /$regexp/); ...
my $regexp = @ARGV[1]; ... next if ($global =~ /$regexp/o); ...
my $regexp = qr/@ARGV[1]/; ... next if ($global =~ $regexp); ...
The first version compiles the regexp each time you use it, the other two just once. For a longer regexp this may make a big difference.
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Speed of Perl Regex Engine
by runrig (Abbot) on Nov 29, 2012 at 19:30 UTC |
In Section
Seekers of Perl Wisdom