giulienk has asked for the wisdom of the Perl Monks concerning the following question:
Examples:
| Original | Weirdex |
|---|---|
| giulienk | gilnk |
| larry wall | larywl |
| etheroskedasticity | ethrskdstcty |
My first coding of Weirdex is
sub weirdex { local $_ = shift; my ($weirdex, $vowel) = ('', 0); s/[^a-zA-Z]//g; for (split '') { if (/[aeiou]/i) { $vowel++ or $weirdex .= $_; } else { $weirdex .= $_ if substr($weirdex, -1, 1) ne $_; } } return $weirdex; }
I'm interested in more elegant/efficient solutions, only regexp solutions and even Golf/Obfu ones.
Thank you.
$|=$_="1g2i1u1l2i4e2n0k",map{print"\7",chop;select$,,$,,$,,$_/7}m{..}g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Weird "soundex" algorithm
by broquaint (Abbot) on Aug 28, 2003 at 15:17 UTC | |
by giulienk (Curate) on Aug 28, 2003 at 15:32 UTC | |
by diotalevi (Canon) on Aug 28, 2003 at 19:10 UTC | |
by broquaint (Abbot) on Aug 28, 2003 at 23:58 UTC | |
by diotalevi (Canon) on Aug 29, 2003 at 01:53 UTC | |
|
Re: Weird "soundex" algorithm
by jmcnamara (Monsignor) on Aug 28, 2003 at 15:20 UTC | |
|
Re: Weird "soundex" algorithm
by rcaputo (Chaplain) on Aug 28, 2003 at 15:46 UTC | |
|
Re: Weird "soundex" algorithm
by Aristotle (Chancellor) on Aug 28, 2003 at 16:03 UTC | |
|
Re: Weird "soundex" algorithm
by Anonymous Monk on Aug 28, 2003 at 15:37 UTC | |
by broquaint (Abbot) on Aug 28, 2003 at 15:51 UTC | |
by PhilHibbs (Hermit) on Aug 29, 2003 at 12:15 UTC | |
|
Re: Weird "soundex" algorithm
by giulienk (Curate) on Sep 01, 2003 at 06:56 UTC |