[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] words words words



>>>>> "SA" == Steven Alexander <stevena@teleport.com> writes:

SA> What would be a fun (short | elegant | fast) way, given two files
SA> with nine- and three-letter words one per line, respectively, of
SA> listing only those nines which are the concatenation of three
SA> threes?

No epiphanies here, but this one is a lot faster than your fastest and
not much longer than your shortest.

  #!perl -n

  BEGIN {
    open T, "threes";
    chop(@t=<T>);
    @t{@t} = (1) x @t;
  }
  grep {!$t{$_}} /(...)/g or print;

Hope you have a very nice day, :-)
Tim Ayers (tayers@bridge.com)


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe