Is there an elegant way to make sure that a string contains a list of 
strings, but not necessarily in any particular order? Here's how I'm doing 
it:

#!/usr/bin/perl -w

use strict;
my @strings=qw(onetwothree threeonetwo onetwonope);
my @matches=qw(one two three);
foreach my $string (@strings) {
    my $success=1;
    foreach my $match (@matches) {
        ($string=~/$match/) ? (next) : ($success=0);
        last;
    }
    ($success) ? (print "$string matches.\n") : (print "$string does not match.\n");
}

Pete

-- 
http://emerson.wss.yale.edu/perl
Pete Emerson
WSS AM&T Yale University



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to