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


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

Nice solution; ++tye.

Changing

$len= length( ( $dif =~ /^(\0+)/ )[0] );
to
$len= length( ( $dif =~ /^(\0+)/ )[0] || '' );
will make it run quiet under warnings when the common prefix is the empty string.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^3: Find common prefix from a list of strings (*)
by tye (Sage) on Jul 14, 2003 at 20:48 UTC

    Oops. That + should have been a *. Thanks for the hint. (:

                    - tye