I. Data Types(Data type):
Perl has four data types: Scalar (variable), Scalar Array (Array), Hash Array (Hash), and References (pointer ), it seems to be rare, but it is more than enough to use it. Especially when writing Perl programs, you do not
Basic usage # initialize % H as an empty array % H ={}; # use an array to initialize % H as a => 1, B => 2% H = ('A', 1, 'B', 2); % H = ('A' => 1, 'B' => 2); # If the key is a string, % H = (a => 1, B => 2) can be omitted. # Use {} to access print "$
Chapter 2: References
References are declared as scalar types (named variables starting with $), and reference is obtained using the \ operator.
Modifying the referenced variable is equivalent to modifying the reference pointing to the
I. Introduction of the ModuleModule is the Perl package. The Perl object is based on a reference to the data item in the package.When you use object-oriented programming in other languages, you declare a class and then create an object (instance) of
There are five variables in Perl:
Scalar, pointer, array, hash and handle.
1. scalar
Let's take a look at scalar. scalar is the simplest data type in Perl. Variables of this data type can be numbers, strings, floating-point numbers, and are not
Chapter 2: List and array list
(): Empty list, false when used as a condition judgment
Two non-empty list examples: ("hello", "world", "\ n") (123,456,789)
Different types of elements can be contained in the same list.
The list in Perl is only
Array and hash table
Ruby arrays and hash tables are index sets. Both objects are saved and can be read by keys. The key of the array is a number, but the hash table supports the object as the key. They all grow with the addition of new elements.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.