Solved

detect a scalar

Posted on 2000-02-24
7
320 Views
Last Modified: 2010-05-18
hi, is there a way to detect a scalar whether it contains numbers or char?

thx

0
Comment
Question by:kitwei
7 Comments
 

Accepted Solution

by:
scudweb earned 50 total points
Comment Utility
number:
if ($yourscalar=~ /\d/)
{
}

char:
if ($yourscalar=~ /\w/)
{
}
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
perldoc -q "How do I determine whether a scalar is a number/whole/integer/float"
0
 

Author Comment

by:kitwei
Comment Utility
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.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 5

Expert Comment

by:PC_User321
Comment Utility
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.
0
 
LVL 5

Expert Comment

by:PC_User321
Comment Utility
I have though of a better example
   "1234" and ">/34".
0
 

Author Comment

by:kitwei
Comment Utility
don't worry, I'll try all cases, I'm learning Perl, so I don't mind getting more info and giving away pts
0
 

Author Comment

by:kitwei
Comment Utility
great, thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now