Scalar Variable in Perl




The following post will explain you the rules and example to use scalar variable in perl language.

Scalar variable can be used to define single or multiple values.


Here in the following example, I have declared the variable $firstname, $lastname and $age as single value and $Designation as multiple values inside “” double quotation.

#!/usr/bin/perl -w
# Example script to declare Scalar variable

$firstname = "Siranjeevi";
$lastname = "Rajendran";
$age = 24;
$Designation = "Systems Engineer";
print "$firstname $lastname with age $age is working as $Designation\n";


The output would be

Siranjeevi Rajendran with age 24 is working as Systems Engineer

Thank you for viewing


  1. ??????????? says:


    ?????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????

    ??????S??????????????N???????N???????N??????N??????N????????N????????N???????? ?N???




Leave a Reply

Protected by WP Anti Spam