in reply to Find the common beginning substring in an array of strings
Updated: To correct odd number problem identified my mbethke and AnomalousMonk below.
@array_of_test_names = ( ... );; $mask = '';; $mask ^= $_ for @array_of_test_names;; $mask ^= $array_of_test_names[0] if @array_to_test_names &1' $mask =~ m[^(\0+)] and $len = length( $1 );; print substr $array_of_test_names[ 0 ], 0, $len;; History - Family History - Suite with Patient - Clinic -
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find the common beginning substring in an array of strings
by mbethke (Hermit) on Jun 06, 2012 at 18:16 UTC | |
by BrowserUk (Patriarch) on Jun 06, 2012 at 18:54 UTC | |
|
Re^2: Find the common beginning substring in an array of strings
by AnomalousMonk (Archbishop) on Jun 06, 2012 at 18:27 UTC | |
|
Re^2: Find the common beginning substring in an array of strings (Updated)
by brx (Pilgrim) on Jun 07, 2012 at 11:50 UTC |