>From fwp-l@cfcl.com Wed Mar 28 01:57:04 2001 On Wed, Mar 28, 2001 at 03:14:43PM +1200, Jasvir Nagra wrote: > A good par is 78 strokes. But this is rather memory hungry and I look > forward to better solutions - its not a difficult problem...more so > that the resulting word lists would be fun (to use?). > > perl -e'chomp(@_=<>);map{$c=$_;map{print"$c $_\n"if!($_ >eq$c)&&(($_&$c)eq$_)}@_}@_' I count 74 strokes there. My first version is a little lighter on memory and prints matches during input. It's 68 chars. It doesn't like double words. perl -pe 'chop;$x=$_;$c=($_&$x)=~/($_|$x)/?"$x $_\n":""for keys%a;$a{$x}=1;$_=$c' -Sven -- We have found all life forms in the galaxy are capable of superior development. -- Kirk, "The Gamesters of Triskelion", stardate 3211.7 ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe