Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Find common prefix from a list of strings (tye)

by sauoq (Abbot)
on Jul 14, 2003 at 20:41 UTC ( #274153=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://274153]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2020-01-24 02:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?