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.
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.
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);
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");