Another solution, which IMHO is a little more elegant than having to parse the output of another module: Scalar::Util's isdual() will return true for a scalar that has both a number and string representation. As documented, this is true for a number used in string context and the reverse for a string.
So a scalar is a number if it becomes dual after stringification, and is a string if it becomes dual after numification (and is a trap if already dual to begin with ;-) ).
perl -MScalar::Util=isdual -E "@v = (0, 1, 2, '3', '4', '5'); push @v,
+ @v; push @v, $v.$v; push @v, $v+$v; isdual($_) and say f
The push @v, @v is to check that a variable's copy is left unaffected by the stringification/numification of the original (yes it's a very weak and useless check :P). After that, I stringify $v and numify $v. (The values 2, and 5 are unused so not dual, 1 and 3 are used as number and string respectively, which they already were)