One, SystemPerl can also invoke the Shell's command with system, which, like Awk's system, returns a value that is also the exit state of the command it invokes.
Copy Code code as follows:
[Root@ax3sp2 ~]# Cat aa.pl
#! /usr/bin/perl-
First, the condition judgment
if () {
}
elsif () {
}
...
else{
}
Second, Cycle:
1, while loop
while () {
}
2, until cycle
Until () {
}
3, Class C for the loop, such as
for ($count =1; $count # statements inside the loop go
}
Here is an example
Copy Code code as follows:
#!/bin/perl
Use strict;
Use warnings;
#定义变量
My $count;
My $input;
My $number;
My $sentence;
My $story;
#定义四个数组
#定义了人物数组
My @nouns =
(
' Dad ',
' TV ',
' Mom ',
' Groucho ',
' Rebecca ',
' Harpo ',
An introduction to regular expressions in Perl
First, Introduction
Two, matching operator
Iii. special characters in the pattern
1, character +
2, characters [] and [^]
3, character * and?
4, escape character
5. Match any letter or number
6, Anchor
Reverse Connection code:
1. #!/usr/bin/perl
2. #usage:
3. #nc-vv-l-P PORT (default 1988) on your local system First,then
4. #Perl $ Remote IP (default 127.0.0.1) Remote_port (default 1988)
5. #Type ' exit ' to exit or press Enter to gain shell when
first, open, close the file
The return value of open is used to determine whether the operation that opened the file succeeds, returns a value other than 0 when it succeeds, and returns zero when it fails, so it can be judged as follows:if (Open
A summary of the use of Kazakhstan in Perl
To assign values to a hashing value pair with a fat arrow
%some_hash = (' jim ' => ', ' Tom ' => ', ' Jerry ' => ' 21 ');
Convert Hash to List
%any_hash = (K1, ' v1 ', K2, ' v2 ', K3, ' v3 ', K4, ' V4 ')
PPM tool tip for Perl (version 5.18.2) under Win8.1 (PRO):C:\Users\ Ning >ppmPPM GUI failed:dbi connect (' Dbname=c:\users\ ning \appdata\local/activestate/activePerl/1802/ppm-mswin32-x64-multi-thread-5_18.db ', ',...) Failed:unable to open DAtabase
UsageThere are two usages, all of which are reconciled to the reference.The first use is to dereference.The different types of references are solved according to the symbols followed by, ->[] represents the coefficient group reference,->{} means
This article is compiled from a question about Perl scalar context and list contexts, explaining why in some cases, using a "list" in a scalar context does not give you the number of elements you want, and how to get the results you expect.1. "List"
About LDAP:LDAP stands for lightweight Directory Access Protocol. It is usually used to fetch (and sometimes update) data in a directory of people.Using NET::LDAP module in Perl can provide a by interact with the this database.Perl script to get
1. variable name DefinitionPerl's common variables, hash variables, and array variables start with $, %, and @, respectively, and all PHP variables start with $, which seems to be more concise. In addition, the PHP hash array itself is already
Chomp can remove a line break from the end of a string. This is basically all the functions it can accomplish, as shown in the following example:$ Text = "a line of text/N"; # It can also be input by Chomp ($ text); # Remove the line break (/N ).It
Perl "glue" can combine code from various applications or languages. Perl can write common scripts, CGI Modules can be used to write web applications, and DBI can be used to access various databases. In addition, Perl can stick applications of
In Perl development, it is very likely that some files in different formats, such as XML, PDF, CSV, and RSS files, are different from some binary data formats. Perl applications need to operate on these files to read and write them.
In this case,
As a software developer, sometimes some processes on the server need to be monitored to understand the running status of the server. Therefore, when an exception occurs, the email prompt is a good choice, which enables developers to perform
I often need to extract a large amount of web page data (more than 1500 pages). I have tried many methods and can achieve this, but the efficiency is not too high.
At the beginning, lwp: simple (get) is used to download and extract data in sequence.
This article focuses on the concept of a Perl hash table. The Perl language and other programming languages have different features. Here we will share with you the concept of a Perl hash table, in fact, a Perl hash table is a structure.
Perl hash
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service