Skip to content

Instantly share code, notes, and snippets.

@kimmel
Created September 10, 2012 06:42
Show Gist options
  • Save kimmel/3689276 to your computer and use it in GitHub Desktop.
Save kimmel/3689276 to your computer and use it in GitHub Desktop.
simple text matching with index
#!/usr/bin/perl
use v5.14;
use warnings;
use utf8::all;
use File::Slurp qw( read_file );
my $pattern_list = do 'fw.pl';
my @patterns = keys $pattern_list;
my $content = read_file( 'dracula.txt' );
foreach my $term (@patterns) {
if ((index $content, $term) > -1) {
#say $term;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment