There is no any need to specify a type for your data in a Perl program. There are following basic data types available in perl:
Scalars in perl are simple variables, are preceded by a dollar ($) sign. A scalar in perl is either a number, a string, or a reference. Here are some examples of scalars in perl:
$first_name = "codes"; $last_name = "cracker";
Hashes in perl are unordered sets of key/value pairs, you access using the keys are subscripts. Hashes in perl are preceded by a percent (%) sign. Here are some examples of hashes in perl:
%marks = ("first" => 100, "second" => 99, "third" => 98); %roll = ("Devraj" => 15, "Vinay" => 46, "Ashwani" => 10);
Arrays in perl are ordered list of scalars, you access with a numeric index, starts from 0. Arrays in perl are preceded by an at (@) sign. Here are some examples of arrays in perl:
@marks = (100, 99, 98); @names = ("Devraj", "Vinary", "Ashwani");
© Copyright 2021. All Rights Reserved.