#!/usr/bin/perl -w use strict; my @bad = (); my ($f, $fh, $baddies, $sql, $badregex) = ('./badactors.txt',undef, undef, '', undef); open($fh, '<', $f) or die $!; while(<$fh>){ chomp; next if m/^$/; push @bad, $_; } close($f); $baddies = join qq{\|},@bad; $badregex = qr~$baddies~; # easy test my $junk = 'doodle bot'; if ($junk=~m/$badregex/) { print qq~\nSee....?\n~; } 1; __DATA__ $dbh->do("INSERT INTO Site_Visit SET firstVisit = NOW(), lastPage = ?, firstPage = ?, IP = ?, userAgent = ?, orsa = ?, orta = ?, Person_idPerson = ?", undef, $ENV{'REQUEST_URI'}, $ENV{'REQUEST_URI'}, $ENV{'REMOTE_ADDR'}, $ENV{'HTTP_USER_AGENT'}, $cookie{'orsa'}, $data{'orta'}, $user) unless $ENV{'HTTP_USER_AGENT'} =~ /bot/i or $ENV{'HTTP_USER_AGENT'} =~ /facebook/i or $ENV{'HTTP_USER_AGENT'} =~ /dataprovider/i;