Somu wrote:
Actually thats what i was looking for: l.*o.*r
So, if the user entered string is to be matched for 'lpt', then i'll
use l.*p.*t ?
And to match 'npr' i use .*n.*p.*r ?
Somu you need to tell us exactly what match you want, otherwise we can't
tell you whether something will work or not. Are you simply checking whether
the input string contains all of the match characters? I would forget about
sorting the input string and do it as in the program below. But please
explain what the problem is instead of asking how to implement a solution
which may not be optimal.
HTH,
Rob
use strict;
use warnings;
print "Match\n" if match('orql', 'lor');
sub match {
my ($input, $match) = @_;
foreach (split '', $match) {
return '' unless $input =~ /\Q$_/;
}
return 1;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/