Posted:
Sat Mar 01, 2003 10:54 pm (21 years, 1 month ago)
What are you actually trying to do? Perl doesn't care; it will convert numbers to characters and characters to numbers when it needs to.
If you want to figure out if a string contains nothing but numeric entries, you could use
Code:
$foo =~ tr/0-9//d;
and then take the length of the remaining string. This command (I think, anyway) will take $foo and remove all numeric characters. Suppose $foo contains 1234ABC. What's left after this is ABC. If $foo contains 1234, what's left is an empty string. Therefore the item is numeric.
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.