Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Character to number and back again

Status
Not open for further replies.

BobZwick

Programmer
Mar 23, 2001
8
US
How do I convert a character string 101 to a numeric value, increment it to 102 then convert it back to a charater string ?

Thanks a bunch!
 
Perl doesn't strictly type strings and numbers, so you really don't have to worry about it. This will work just fine:
Code:
$x = "101";
$x++;
print "x = $x";
It would print out 102.

Perl's attitude is: If you use it as a string, it's a string. If you use it as a number, it's a number. Most of the time it doesn't make any difference.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top