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

Re: [FWP] Love & Hate shenanigans



Sven Neuhaus <sn@neopoly.com> wrote:

> 55. Duh. I shall quit for now. Promised.
> perl -lne '$x=$_;($_&$x)=~/$_|$x/&&print"$x $_"for keys%a;$a{$x}=1'

Why the hash?  Using an array is 4 shorter:

perl -lne '$x=$_;($_&$x)=~/$_|$x/&&print"$x $_"for@a;push@a,$x'

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC

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