Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Perl question - string to int conversion..Help!!!!

Posted on 2005-03-08
1
Medium Priority
?
198 Views
Last Modified: 2006-11-17
I have an snmpget which returns the packet count as a string... "123456"
I included functionality to remove the quotes, and I am trying to store this information as an int into a round robin database.

However, I believe the database is reading it as a string.  Is there some conversion I need to do in order to take that string and use it as an integer?
0
Comment
Question by:jewee
1 Comment
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 13491296
You shouldn't need to worry about conversion.

Perl uses context to work out if you are using a string or number,  For example:

$a=123;
$b="123";

print $a + 100 . "\n";
print $b + 100 . "\n";

will give you the same result.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
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…
Six Sigma Control Plans
Suggested Courses

571 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