in reply to matching strings...

The second way, Is much too long, as I'll have several different ones to search, more then 3, less than 10.

To make things more flexible, you can generate your regex on-the-fly using the qr operator. A simple-minded example:

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

I don't know if it could help your program doing something like this, but it's just an idea.

Arjen

Update: This will only work with strings that do not contain regex metacharacters.