Rodrigo Tavares wrote:
Hello,

I want to convert the int for string, then use the
function lenght, and return the size of string.

How It is possible ?

Perl automatically converts a number to and string (and back again) as needed.  
To get the length of its string, use the length function:

 my $length = length( $number );

Example of automatic conversions:
#!/usr/bin/perl

use strict;
use warnings;

# set $num to a number
my $num = 123;
# convert it to a string for printing
print "$num\n";

# concatenate the character zero to its end
$num .= '0';
# print the string
print "$num\n";

# divide the string by 2
$num /= 2;
# convert it to a string for printing
print "$num\n";

# convert to a string and get its length
print length($num), "\n";

__END__


--
Just my 0.00000002 million dollars worth,
 Shawn

"For the things we have to learn before we can do them, we learn by doing them."
 Aristotle

"If you think Terrans are comprehensible, you don't understand them."
 Great Fang Talphon

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to