in reply to longest common substring... almost?
This yieldsuse Text::Abbrev; chomp(my @a = <DATA>); s/\s/_/g foreach @a; my %hash = abbrev @a; print "$_ $hash{$_}\n" foreach sort keys %hash; __DATA__ RPL AUSTRIA AR REPORTING RPL AUSTRIA AR REV ACCT
the set of all possible unique abbreviations of your list of words, which is frequently what one wants. If you want just the shortest abbrev, pick the first member for each value from the sorted list above. The underscores are for readablility, you can drop them.RPL_AUSTRIA_AR_REP RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPO RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPOR RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPORT RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPORTI RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPORTIN RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REPORTING RPL_AUSTRIA_AR_REV RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_ RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_A RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_AC RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_ACC RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_ACCT RPL_AUSTRIA_AR_REV_ACCT
-Mark
|
---|