Link to home
Start Free TrialLog in
Avatar of kitwei
kitwei

asked on

detect a scalar

hi, is there a way to detect a scalar whether it contains numbers or char?

thx

ASKER CERTIFIED SOLUTION
Avatar of scudweb
scudweb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
perldoc -q "How do I determine whether a scalar is a number/whole/integer/float"
Avatar of kitwei
kitwei

ASKER

I don't have access to try the code until monday, and I must try it that day. I promise I will respond.
Thank you very much.
Hi kitwei,
This question is a repeat of question Q_10300771, which was asked (and answered) before this one appeared.

What test do you want to do on the data?
ozo and I assumed you wanted to know whether or not it _was_ a number, and scudweb assumed you wanted to know if it contained a digit (0-9) anywhere within it.
e.g. my test would regard "1234" and "12  34" as different, but scudweb's test would regard them as the same.
I have though of a better example
   "1234" and ">/34".
Avatar of kitwei

ASKER

don't worry, I'll try all cases, I'm learning Perl, so I don't mind getting more info and giving away pts
Avatar of kitwei

ASKER

great, thanks