July 6, 2022

You may want to Read Practitioner Programming Perl and Step to Run Perl First .
Scalar data can be defined as a data that can be manipulated by perl, can be:

-digit numeric
-character-string,

and the data we can add the value of a particular service before the data, such as plus signs, minus percent and so forth. All scalar variables using the dollar sign “$” as the beginning of the name.

Example of the correct name of the variable:

$ example
$ canlongcharacter
$ corect_name_scalar_variabel

instance Wrong variable name

$ Example
scalar variable $ name is incorrect

Keep in mind that the use of letter writing in the scalar variable is very sensitive to the difference between capital and lowercase letters. So if you make $ skalar number of variables, then you can not be called with the variable $ scalalr TOTAL
operator in manipulating the use of scalar variables is very flexible. Note the examples of the following cases:

$ a = 2;
$ b = 6;
$ c = $ a. $ b; # The “.” service integration 26
a # character
$ d = $ c / 2;
print $ d;

the results are:

13

On the use of characters, there are several things that need to be
Single-quoted or single quotation

* Double quoted or quotation double

single quotation generally will not translate what is in it. While the quotation ganda translate what is there in it, including variables.note the following example:

#! / usr / local / bin / perl-w
# Show warnings
$ who = ‘Yon Yonson’;
$ where = ‘Wisconsin’;
$ what = ‘in a lumbermill’;
print “My name is $ who, \ n”;
# Let’s introduce ourselves

print “I live in $ where, \ n”,
“$ What I work there. \ N”;
# Remember the line breaks
print “\ nSigned: \ t $ who, \ n \ t \ t $ where. \ n”;

the results are:

My name is Yon Yonson,
I live in Wisconsin,
I work in a lumbermill there.
Signed: Yon Yonson,
Wisconsin

The special characters in, among others:

Character printing results
\ b Backspace
\ c the line is terminated without newline
\ f formfeed
\ n newline
\ r Carriage return
\ t tab character
\ \ Reversed virgule character
\ nnn the character has ASCII value nnn,
where nn is 1 to 3 octal digit number

Related Post

Steps to Run Perl

Practitioners programming perl