perl -e 'print "Result of division is not an integer.\
" if (14/7) =~/\\D/'
works fine.
That said, the more standard way of testing whether a value is an integer is:
perl -e 'print "Result of division is not an integer.\
" if 14/7 != int 14/7'
The intention is clearer this way, since you’re explicitly testing whether the value is equal to the integer portion of the value instead of looking for the presence of non-numeric characters, which you could be doing for many other reasons.