Google News
logo
Perl - Interview Questions
How many types of primary data structures in Perl and what do they mean?
The scalar : It can hold one specific piece of information at a time (string, integer, or reference). It starts with dollar $ sign followed by the Perl identifier and Perl identifier can contain alphanumeric and underscores. It is not allowed to start with a digit. Arrays are simply a list of scalar variables.
 
Arrays :
 
Arrays begin with @ sign. Example of array :
my @arrayvar = ("string a", "string b "string c");
Associative arrays: It also frequently called hashes, are the third major data type in Perl after scalars and arrays. Hashes are named as such because they work very similarly to a common data structure that programmers use in other languages–hash tables. However, hashes in Perl are actually a direct language supported data type.
Advertisement