http://www.perlmonks.org?node_id=274199


in reply to Re: Find common prefix from a list of strings
in thread Find common prefix from a list of strings

Here is a sort version of Jenda's solution
my @files = qw(model4run1 model2run1 model4run2 model1run1); my $same = $files[0]; $same &=$_ for @files; ($same) = split 0x00, $same,2; print "Prefix is \"$same\"\n";