1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/usr/bin/perl use 5.008; use strict; use warnings; use locale ':not_characters'; my @words = ( 'ルイビトン!', 'ルイビトン', 'V1$gRa!', 'Viagra', 'интернет!', 'товары', ); while (my $line = <DATA>) { for my $spamword (sort @words) { print ($line =~ /\b\Q$spamword\E\b/i ? "Spam: $spamword -> $line" : ''); } } __END__ __DATA__ CAT & CATZE ルイビトン ルイビトン! 8I_Iy ViAGra! Test.Toast интернет! Perl's son is not Tim Towdy!
Cannot decode string with wide characters at C:\strawberry\perl\lib/Encode.pm line 176, <> line 2.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
sub testspam { my $comment = shift; chomp $comment; use Encode; $comment=Encode::decode( 'utf-8', $comment ); read_blacklist(); for my $black (@blacklist_entries) { if ( $comment =~ /\b\Q$black\E\b/i ) { return "badword_comment $black"; } } }
/\b$BOESESWORT\b/