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 ',
program file: test.pl
Copy Code code as follows:
#!/bin/perl
# filename:test.pl
Use strict;
Use warnings;
#随便找一个比较好识别的序列
My $DNA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n";
my $i;
My $mutant;
Srand (time|$$);
In file I/O, to read data from a file, the application first calls the operating system function and transmits the file name, and chooses a path to the file to open the file. The function retrieves a sequential number, the Perl file handle
The judgment of NULL value
$t {Type1id} = $ $pref {dbh}->selectrow_array ("Select Type1id from enq1 WHERE id =
3 ");
if ($t {type1id} = = 0) {
Print "Type1id is null\n";
}
==> is not a numeric term, this statement has a problem. Numeric items are
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
1. Using the grep functionFunction name grep
Call Syntax @foundlist = grep (pattern, @searchlist);
Explanation similar to the UNIX lookup tool with the same name, the grep function extracts the element in the list that matches the specified pattern,
Http://www.cnblogs.com/morebetter/archive/2007/05/10/741752.html
Many times, we want to make some changes to the contents of the original file, although Linux has sed this powerful text editing command, but he can only generate new files or print
When using echo to output a file, if the file has double quotes, you need to use [code lang= "Perl"]echo ' Yourtext '; [/code] (enclosed in single quotation marks) questions about Perl here Document:
[Code lang= "Perl"] print >> END; YOUR TEXT here
Help (Dit.keys)---to see a description of the keys function in the dictionary typeAbout PrintPython---String can be followed without adding \ nthe line wrappingThe per---does not wrap automatically, and must be added \ nAbout executing SQL
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
On the Unix/linux system, open the command terminal, enter ' Rpm-q Perl ' to see if Perl is installed on the system----on its own CentOS7 system, with Perl software by default:Perl Perl-5.16. 3-286. el7.x86_64You can see that the system has PERL5
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
Perl class is a Perl Package First, create a package file named cocoa. PM (the extension PM is the default extension of the package, meaning perlmodule ). A module is a package, and a package is a class. Before doing other things, add the line "1;".
How to handle this line of error messages?
Please install the GCC make Perl packages from your distribution.
Run the command: Yum install GCC Perl make
Output:
Loaded plugins: product-ID, search-disabled-repos, subscribe-Manager
This system is
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.