Friday, May 15, 2015

Data containers and basic operations

Data containers:

Perl has three basic type of variables i.e data containers:

1. Scalar:   simple variable which holds only one value. The value can be either integer, float or string. Syntax of using a scalar is following:

my $int_var = 10;
my $ float_var = 5.9;
my $str = 'This is a string value';

2. Array:  can hold a list of values. Values can have different types i.e integer, float or string. Syntax of using an array is following:


3. Hash: is a set of key value pairs. Syntax of using an hash is following:

No comments:

Post a Comment