Concatenating a number and a string : Casting « Data Type « Perl






Concatenating a number and a string

  

$string = "Top 10";
$number = 10.0;
print "Number is 10.0 and string is 'Top 10'\n\n";

$concatenate = $number . $string;     
                                      
print "Concatenating a number and a string: $concatenate\n";

   
    
  








Related examples in the same category

1.Adding number to a string
2.String is converted to a number automatically
3.How Strings Are Converted to Numbers
4.What happens if we try and join a number to a string?
5.Converting Strings to Numbers
6.The result when these two strings are compared depends on whether a string or integer comparison is being performed.
7.String (with digits) is converted to number during the math operation
8.String (without digits) is converted to number during the math operation