?
Solved

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

Posted on 2005-03-08
1
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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

752 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