#!/usr/bin/perl use strict; my @Strings = qw(lmn lpt lor mps npr nqt opq rst); chomp(my $Input = <STDIN>);
my $SortedChars = join "", sort (split //, $Input); foreach (@Strings) { if ($SortedChars =~ /$_/) { print "Got a match for $Input with $_\n"; } } Somu <[EMAIL PROTECTED]> wrote: Hi, i have a matching problem. I get input from the user as a 3-5 character long string consisting of characters from 'l' to 't', and the chars are always sorted for example, the user enters: 'lrqo'. It becomes: 'loqr'. But i have to match the modified string to any of the following: lmn, lpt, lor, mps, npr, nqt, opq, rst. i'm unable to think of the regexp. Actually i'm trying to write a Tic Tac Toe.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/