http://www.perlmonks.org?node_id=1010279


in reply to Re: Determining if a rational number terminates
in thread Determining if a rational number terminates

Shorter still:

perl -E'$_=10;$_/=5until$_%5;say$_&$_-1?N:Y'