XORing a number gives zero, so the function returns 1. XORing a string gives a string of nulls, still a non-empty string, so the function returns 0sub isnum ($) { $_[0] ^ $_[0] ? 0 : 1 }
In reply to Re: How to check if a scalar value is numeric or string?
by ibravos
in thread How to check if a scalar value is numeric or string?
by bgupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |