Solution Review: Make Variables
Let's see the detailed solution review of the variable challenge given in the previous lesson
We'll cover the following...
We'll cover the following...
Let’s have a look at the solution before jumping onto the solution:
Perl
$intNumber = 1000;$charName = 'N';$boolAccept = 1;$floatNum = 10.292;print $intNumber . ", ";print $charName . ", ";print $boolAccept . ", ";print $floatNum;
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.