in reply to Find common prefix from a list of strings
- tyesub FindCommonPrefix { my $model= pop @_; my $len= length($model); for my $item ( @_ ) { my $dif= $model ^ substr($item,0,$len); $len= length( ( $dif =~ /^(\0+)/ )[0] ); substr( $model, $len )= ""; } return $model; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Find common prefix from a list of strings (tye)
by sauoq (Abbot) on Jul 14, 2003 at 20:41 UTC | |
by tye (Sage) on Jul 14, 2003 at 20:48 UTC |