Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!aplcen!haven!uvaarpa!mmdf From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: need perl help Message-ID: <1948@uvaarpa.virginia.edu> Date: 4 Jan 90 19:01:12 GMT Sender: mmdf@uvaarpa.virginia.edu Reply-To: merlyn@iwarp.intel.com Lines: 26 |> I would like to remove pairs of a letter from a string. After I remove |> spaces & vowels, something like this: |> $a =~ tr/AEIOU/ /; |> $a =~ s/ //og; |> I then would like to remove double letters something like |> wizzard --> wizard |> This all goes toward building a key to compare names, addresses, etc... to |> eliminate duplicates. |> |> Does anyone have any ideas? There's probably a more elegant way to remove |> the vowels and spaces too, for that matter. Well, the spaces and vowels is best done with: $a =~ s/[aeiou ]+//g; And the duplicate letters is then done with: while ($a =~ s/(.)\1/\1/) { ; } Just another Perl hacker, /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/