Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: lHow to do a reverse word list in Perl

From:Kris Kowal <cowbertvonmoo@...>
Date:Friday, October 27, 2006, 18:06
So, adding schwartzian transform, using the default input <>, and
making a few idiomatic perl suggestions of my own:

#!/usr/bin/perl -w
print for
    map {$_->[1]}
    sort {$a->[0] cmp $b->[0]}
    map {
        [
            (reverse $_),
            sprintf "%20s", $_
        ]
    }
    <>;


On 10/27/06, Mark J. Reed <markjreed@...> wrote:
> On 10/27/06, Dirk Elzinga <dirk.elzinga@...> wrote: > > Since you're sorting from the end, all words sharing a suffix will be > > grouped together.This can be a big help if you're doing a > > morphological analysis. > > Ah, morphological analysis. That makes more sense. (I was thinking > maybe it was a first cut at a rhyming dictionary...) > > > -- > Mark J. Reed <markjreed@...> >