Comparing to other programs this scanner is very, very slow. I have also some troubles with some long patterns, but this is a small problem. Any idea how to improve to make it running faster? Thank you!!my $patterns = "/path/to/file.txt"; my $arg1 = shift; open(PATTERNS, "<$patterns") || die("Cannot Open '$patterns'"); my @list_patterns = <PATTERNS>; close(PATTERNS); open(FILE, "<$arg1") || die("Cannot Open $arg1"); my $file = join('',<FILE>); close(FILE); foreach my $list_patterns ( @list_patterns) { chomp ($list_patterns); if ($file =~ m/$list_patterns/is) {print "\n$arg1\n$list_patterns\ +n";} }
In reply to Comparing pattern by mrc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |