Re: In these times of economic crisis...
robert wilson <[email protected]> Sun, 26 Apr 2009 05:46:01 -0400
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
Phil Carmody wrote:
> We need dollar-free golf!
>
> In order to answer the question "what ratio of words in the SOWPODS wordlist share no letters in common with the word mackerel?", I quickly threw this together:
>
> perl -ne '$c[m/[mackrel]/]++;}print($c[1]/$.,$/);{' < sowpods
>
> However, there were complaints that it had too many dollar signs.
>
> What's the shortest equivalent script which uses no dollar signs at all?
>
> Phil
perl -le 'print+(grep{/[mackrel]/}@w=<>)/@w' < sowpods
?
now, if you actually want the answer to the question "what ratio of
words in the SOWPODS wordlist share _no_ letters in common with the word
mackerel?", you'd need to add a "!", like this:
perl -le 'print+(grep{!/[mackrel]/}@w=<>)/@w' < sowpods