Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the basics of Perl

Shulou Source: shulou.com Published: 2022-06-03 05:31:33 10月27日 Update

This article mainly shows you "what are the basics of Perl", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the basics of Perl" this article.

I. Foundation of Perl

1. Common command

1.1perl-v displays the Perl version and tests whether Perl is installed

1.2perldoc-tf looks up function information

1.3perldoc-q finds FAQ

1.4perl is an interpreted language and does not need to be compiled; Python is a virtual machine language that needs to be compiled.

II. Perl widget: data, string

1. Escape characters are represented by\

2. QQ _ quotient operator, using non-characters or numbers as qualifiers

3. Title variable $

4.chomp removes newline characters

5. Input device

6. The formatted string refers to scalars directly in the string.

3. Perl control program flow

1. Empty undef

2. Last _

3.exit0 exits the program normally

4. Perl list / array

1.qw operator declaration list

two。 Definition range 1. 20

3. Define array @

4. Reference array element $[index]

5. Find the array size $size=@array

6. Index number of an element

7.localtime returns a list of time elements that represent the current time

8. Forceful foreachhands var (@ array)

9.split function

10.join function

11.sort sorts the array

twelve。 Airship operator

The 13.scalar function, which forcibly converts to a scalar and puts it in a scalar context, returns the quantity put in.

Scalar@_

5. Perl file operation

1.die function

2.How! Used to return the error message of the operating system in the die function

3.warn

4.definedundef

System variables read by 5.$_foreach

Example:

Open (MYFILE, "c:/manifest.mf") | | die "errerrrig"

These are all the contents of the article "what are the basics of Perl". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Functions characters arrays fundamentals knowledge basics elements content strings scalars articles operators operations variables time programs systems languages learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux Microsoft Apple NVidia