When you send a command line to the system shell, the shell creates a process to execute the command. The new process becomes a child of the shell, and its execution does not depend on the shell but coordinates with the shell.
Similarly, a Perl
First, the condition judgment
Copy Code code as follows:
if () {
}
elsif () {
}
...
else{
}
Another way to build an I-f statement is to use multiple expressions, then, depending on which expression is true,
Common processing signals under Unix
Copy Code code as follows:
No Name Default Action Description
1 sighup Terminate process terminal line Hangup
2 SIGINT Terminate process interrupt Program
3 Sigquit Create core Image quit program
Why use references?
In Perl4, the Value field in a hash table can only be scalar, not a list, which is inconvenient for some situations, such as the following data:Chicago, USAFrankfurt, GermanyBerlin, GermanyWashington, USAHelsinki, FinlandNew
1.Perl the general variable into a scalar, the variable can refer to the direct amount of two kinds: the number of direct volume, string direct.
A) The string representation method:Single quotes, the strings in single quotes are intuitive and do
Special symbols for Perl
@ Array$x {} x preceded by a dollar sign ($) followed by a curly brace ({}), it is a hash element% to reference the entire hash, using the percent sign (") as the prefix. The hash used in the previous pages is
[ORACLE@YYJK esb]$ cat a1.pl use DBI;
Use HTTP::D ate qw (time2iso str2time time2iso time2isoz);
Use NET::SMTP;
Use Encode;
My $dbName = ' esbdb ';
My $dbUser = ' esbdata ';
My $dbUserPass = ' esbdata ';
My $dbh = Dbi->connect
Perl Debug
[From] http://goldenink.com/perl/perldebug.html
The concepts of the Perl debug is familiar to most programmers. Trace, breakpoint, and conditional breakpoint (watchpoint) is effective means with which to find problems in your Perl SC Ript.
As people become more passionate about programming efficiency, scripting languages are popular, including Perl. Here we don't delve into Perl's history, nor do we dispute the merits of Perl and Python, and we'll see how to install Perl on Ubuntu,
#!/usr/bin/perl# Filename:BuildSocketTCP.pm## Copyright Axxeo GmbH# Licensed under the Apache License, Version 2.0 (the "License");# You are not a use of this file except in compliance with the License.# Obtain a copy of the License at##
Demand:The host has hundreds of backup files to Rsync to the remote host, we will cut the large file for dozens of small files for multi-threaded transmission.Here is a demo using 14 1G files:[[Email protected] test]# pwd/root/test[[email protected]
1. Use anti-quotation marks to call an external program and return the output of the program, such as $cwd = ' pwd ';2. The difference between the variable types in Perl is mainly singular and plural; Singular variables are called scalar $scalar,
This pack, unpack in "Perl language programming" has introducedIt looks complicated.1 #Convert A string to a hexadecimal format2 my $source='ABCD';3 Unpack('h*',$source);4 #Note that this ' H ' is a description converted to 16 binary, followed by an
Source:Http://www.cnblogs.com/itech/archive/2012/08/07/2627267.htmlCode:You need to explicitly define variables and initialize them. such as Optionx.If you do not define a variable and explicitly initialize it, and you do not specify an option on
Source: http://www.veryhuo.com/a/view/38338.htmlToday you want to compile the Perl script as an EXE to run independently from the Perl interpreter. Can generate a Perl PE file, which is presented on the Perl website.Perl scripts compiled into EXE
The LWP (short for ' Library for World Wide Web in Perl') is a block group of modules that are used to obtain network data. "Lwp::simple" by calling the Get ($url) function, you can get the content of the relevant URL. If no error occurs, the Get
######################### 1001 ############## ################
Use 5.010; while (<>) {my @ num = split; say $ num [0] + $ num [1];}
######################### 1048 ############## ################
My $ n = 12; my $ sum = 0; while ($ n --) {chomp
Use a subroutine to remove the spaces at the beginning and end of each line read from the file. The print Value of the sub function is no longer blank, but the returned value is printed with spaces. The Code is as follows:
While ()
{
& Trim ($
Document directory
1. The variable type is determined by the symbol above it
2. There is no need to declare a variable in advance
3. No type conversion
4. No character type
5./Not division
6. Let's talk about arrays.
8. No struct or union
9
It is often said that a file is divided into many small files. If you need to "open file handle-write data-Close file handle" after each judgment ", it takes a lot of time to repeatedly open or close the file handle.
The process is often in the "S"
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