sub l{my($s,$t)=@_;sub {($s=($s.(((my $x=$s+$t)=~y/1/1/d)%9%2)))=~s/5./5/;$s}} $x=l("50101","0022");print ($x->(),$x->(),$x->(),$x->());