469,270 Members | 1,118 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Convert string to integer?

109 100+
Hi...

How do i convert from a string to an integer??
Jun 26 '07 #1
4 28963
miller
1,089 Expert 1GB
Your question reveals your ignorance concerning how perl treats scalars. What exactly are you trying to do? What "string" do you have that you're wanting to convert to an integer?

State exactly what you have and what you want.

- Miller
Jun 26 '07 #2
skyy
109 100+
Hi...

I want to convert

my $my_string="123";

into

my $my_int=123;

for some calculation...
Jun 26 '07 #3
skyy
109 100+
Thanks..

i managed to do it with casting...
Jun 26 '07 #4
miller
1,089 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. my $var = "123";
  2. print $var + 3;
  3. # Outputs 126
  4.  
- Miller
Jun 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by news.hku.hk | last post: by
3 posts views Thread by winthux | last post: by
16 posts views Thread by akarui.tomodachi | last post: by
5 posts views Thread by Allerdyce.John | last post: by
43 posts views Thread by Steven T. Hatton | last post: by
3 posts views Thread by tanishka singh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.