Why do you want to see whether it's a number? Perl is happy
to use strings and numbers interchangeably. People make way too
much trouble of this. Normally, all you want to do is

$answer += 0;

To perform this conversion, Perl merely calls your native C librarys's atof(3) function.
Many important benefits come from this approach, which if you try to roll it yourself,
you'll probably miss. Here are some of them:

Your current LC_NUMERIC locale setting is used and respected.
This means that the user's local radix will be respected. For example,
if you're in a country where the USA's notion of comma and period
are switched, the right thing will still happen.

Exponent overflow and underflow produce the results
specified by the IEEE Standard.

The special IEEE notions of
Infinity and
NaN (not a number) will be properly honored:

You may also notice that NaN is neither
==
nor
!= 0, which is probably what you want.
If you disagree with the way your vendor has implemented atof(3),
then complain to them, but you'd better be up on your standards docs first.
If you don't like that
atof(3) tolerates trailing non-numerics, just cope.