Anonymous
public text v1 · immutable#!/usr/bin/perl -w
use strict;
my @queue = qw(
hello
there
thisi
ssome
rando
mstri
);
my %match = (
thisis => 1
);
my $line_size = 5;
my $match_size = 6;
my $count = 0;
my $buffer = $queue[$count];
while(++$count < @queue) {
$buffer .= $queue[$count];
warn "[$buffer] [$queue[$count]]\n";
for my $pos (0..length($buffer)-$line_size) {
my $query = substr($buffer,$pos,$match_size);
if(exists $match{$query}) { print "Got a match\n" } }
substr($buffer,0,$line_size) = '' }