This produces a deprecation warning in recent versions of Perl thanks to ?/?. You can use '/' or "/" instead to avoid the deprecation warning. Perl is smart enough to know you meant a regexp rather than a string if it follows =~.
bigrat is in core, so I don't consider it cheating. Now, if you wrote chkrat.pm, and uploaded it to CPAN specifically to help your golf score, that would be cheating.
However, I'm disappointed by the lack of a line break.
Here's my reinterpretation of your implementation. I've added a line break at the cost of three keystrokes, but managed to save six keystrokes elsewhere...
use bigrat;print((shift()*10**1000/shift)=~"/"?N:Y,$/)
These are also quite cute, though very slightly longer...
use bigrat;print[Y,N]->[(shift()*10**1000/shift)=~"/"],$/
use bigrat;$_=shift()*10**1000/shift;print[Y,N]->[m"/"],$/
In reply to Re^2: Determining if a rational number terminates
by tobyink
in thread Determining if a rational number terminates
by blackle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |