@files = qw(model4run1 modexl2run1 model4run2 model1run1); my @array = split //,shift @files; my @prefix; foreach (@files) { @prefix = (); while ($c = shift @array) { next unless /^$c/; s/^$c//; push @prefix,$c; } @array = @prefix; } print join ""=>@prefix,"\n";
In reply to Re: Find common prefix from a list of strings
by artist
in thread Find common prefix from a list of strings
by Albannach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |