in reply to detecting of scalar is string or numeric

Hi vkhera,

So do I understand correctly that you want to tell the difference between 42 and "42"? That's nontrivial, see How can I test for the representation of an integer? and the links therein, especially the answers to this StackOverflow post. There's also this thread: How to check if a scalar value is numeric or string?, which includes a mention of the ^ trick you're using.

Hope this helps,
-- Hauke D