#!/usr/bin/perl -w use strict; my $words = join("|", qw(these are words that can be matched)); my $wre = qr/^($words)$/i; my $w = ; if ($w =~ $wre) { print "I know that word\n"; }