Perl Data Types

Variables


First a caution: Perl is a weakly typed language. That can be a plus or a minus.

There are three data types in perl

  • Scalars
  • Arrays of Scalars
  • Hashes of Scalars (Associative Arrays)

Scalars are known as a singular context while arrays and hashes are known as a plural context.

CREATED 2017-05-07 19:49:35.0

00-29-E4

UPDATED 2017-05-19 19:09:15.0

Scalar Variables


$myvar = "Hello World!"
print "$myvar "
$myvar = "Hello World!"
$myvar = 3.14159
print "$myvar " 3.14159

Scalar variables are singular or individual variables. They can represent strings or numbers becasue, once again, Perl is weakly typed. A Scalar variable is preceded with a $ i.e. a capitol 4.

In the world of Perl a null value of the Scalar variety is an empty string, a string with a zero i.e. 0 or the value zero i.e. 0. Internally Perl manages the data type.

Using a scalar data type the actual type can be switched on the fly i.e. the type can be switched from string to integer.


CREATED 2017-05-07 21:32:26.0

00-29-E5

UPDATED 2017-05-19 19:09:17.0

Arrays


CREATED 2017-05-07 21:43:08.0

00-29-E6

UPDATED 2017-05-19 19:09:19.0

Hases


CREATED 2017-05-07 21:43:13.0

00-29-E7

UPDATED 2017-05-19 19:09:21.0

L
I
N
K
S

DBID: db.wam

Page Server: Ruger

©2019 Leistware.com
        Hello anonymous