Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Perl only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Perl
Convert string to integer?
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
skyy
New Member
Join Date:
May 2007
Posts:
109
#1
Convert string to integer?
Jun 26 '07, 08:46 AM
Hi...
How do i convert from a string to an integer??
miller
Recognized Expert
Top Contributor
Join Date:
Oct 2006
Posts:
1086
#2
Jun 26 '07, 08:49 AM
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
Comment
Post
Cancel
skyy
New Member
Join Date:
May 2007
Posts:
109
#3
Jun 26 '07, 08:57 AM
Hi...
I want to convert
my $my_string="123 ";
into
my $my_int=123;
for some calculation...
Comment
Post
Cancel
skyy
New Member
Join Date:
May 2007
Posts:
109
#4
Jun 26 '07, 09:24 AM
Thanks..
i managed to do it with casting...
Comment
Post
Cancel
miller
Recognized Expert
Top Contributor
Join Date:
Oct 2006
Posts:
1086
#5
Jun 26 '07, 09:34 AM
[CODE=perl]
my $var = "123";
print $var + 3;
# Outputs 126
[/CODE]
- Miller
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment