Perl Data Type
There are three types of data type are support in Perl programming language which are used in build custom application. In this post mention basic overview of memory management of those data type in package level.
Scalars
scalar data type are representing text string, integers, floating point values and reference. Generally scalar variables can contains a single value. This type of variable are start with $ sign.
#!/usr/bin/perl
package Regular;
use strict;
use warnings;
#variable that contains string literals
our $name = "Smith";
#variable that contains numeric literals
our $age = 25;
our $salary = 50000.60;;

In this example there are three scalar variable are create. Which are contain three different type of values.
Arrays
Array is collection of elements. In perl programming array variables are start with @ sign.
#!/usr/bin/perl
package Regular;
use strict;
use warnings;
our @numbers = (10,20,30,40);
our @day =("Mon","Tus","Thu","Fir","Sat","Sun");
our @record=(1,"Images",1900.34);

Hashes
Hash is collection of key and value pair. The arrangement of hash element is form of an unordered sequence. In perl programming hash variable can be define using of % sign.
#!/usr/bin/perl
package Regular;
use strict;
use warnings;
our %first = ("One",1,"Two",2,"Three",3);
our %second =("Name"=>"King","Age"=>21,"Father"=>"Joh");

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.
New Comment