If you're always looking for prefixes, then something like this may get you the pattern:
Then you just put a * at the end of whatever it returns. If you want to find the longest shared string, well, that would be a bit more difficult.sub prefix { my $prefix = shift; for (@_) { next if $prefix eq substr($_, 0, length $prefix); chop $prefix; redo; } $prefix; }
In reply to Re: Identifiying unique pattern
by Tanktalus
in thread Identifiying unique pattern
by kulls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |