Note that this will consider '00' and some other oddities to be a number. You are probably better sticking with other answers elsewhere in this thread.sub perl_thinks_it_is_number { eval { use warnings FATAL => 'numeric'; no warnings 'void'; 0+shift; 1; } } print "'foo' isn't a number\n" unless perl_thinks_it_is_number 'foo'; print "'17' is a number\n" if perl_thinks_it_is_number '17';
In reply to Re^2: check if its a number
by nobull
in thread check if its a number
by m.y
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |