Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and the $regex value will be something like "A.*A.*A.*".. because I want to match $limit A's in the string. is there any way I can make this more efficiently ?my @ebase = ("A","T"); my $limit = 15; sub lineOK { ($line) = @_; for(@ebase) { $regex = ("$_.*") x $limit; return 0 if($line =~ /$regex/); } return 1; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: searching characters
by moritz (Cardinal) on Jun 17, 2009 at 14:35 UTC | |
Re: searching characters
by Transient (Hermit) on Jun 17, 2009 at 14:37 UTC | |
Re: searching characters
by JavaFan (Canon) on Jun 17, 2009 at 14:41 UTC | |
Re: searching characters
by cdarke (Prior) on Jun 17, 2009 at 15:53 UTC | |
Re: searching characters
by citromatik (Curate) on Jun 17, 2009 at 14:40 UTC | |
by ikegami (Patriarch) on Jun 17, 2009 at 14:51 UTC | |
by JavaFan (Canon) on Jun 17, 2009 at 14:46 UTC | |
Re: searching characters
by Anonymous Monk on Jun 17, 2009 at 16:28 UTC |