Solution Review: Make Variables
Explore how to declare and initialize different Perl variables including integers, characters, booleans, and floating-point numbers. Learn to use the print statement and concatenation operator to display variable values, preparing you to effectively handle Perl variable types in your programs.
We'll cover the following...
Let’s have a look at the solution before jumping onto the solution:
Explanation
We have declared:
-
an integer type variable
$intNumberand assigned it a value of 1000 -
a character type variable
$charNameand assigned it a value of ‘N’ -
a boolean type variable
$boolAcceptand assigned it a value of 1 -
a floating type variable
$floatNumand assigned it value of 10.292
After declaring the variables, we used the print statement to display them and we have used . operator to concatenate the , with the result.