Http://developer.51cto.com/art/201007/211617.htm
This article will focus on the automatic conversion between Perl numbers and strings in the Perl language. Here we will introduce them from seven aspects, I believe you have learned a little
Code:
Variables need to be explicitly defined and initialized. For example, optionx.
If no variables are defined and explicitly initialized, and no options are specified on the command line, the variables corresponding to the options are
Use Regular Expressions
Take two steps:Remove the preceding: $ A = ~ S/^ + //;
Remove the following: $ A = ~ S/+ $ //;
One step:
S/(^ s + | S + $) // G;
Delete the line break at the end of the string:
The chomp function usually
1) The 3 methods for reading files are read by row and saved to the scalar while () {print;} Read by row, and saved to the array @ array = ; read the entire file and store the scalar $ string = do {local $/; ;}; 2) read the file instance open (Ep,
Install your own Perl modules. If you do not have the root permission, install Perl modules in your home directory.
From: http://servers.digitaldaze.com/extensions/perl/modules.html Installing perl5 modules locally
Normally, the perl5 module
The previous section describes the basic data types and usage methods in Perl. This section describes branch loop control and Io.
The syntax of the branch loop in Perl is similar to that in the C family language. The keywords include: If/else,
I. Introduction
The pattern refers to the character of a specific sequence in the string. The backslash contains:/DEF/That is, the pattern def. Its usage is as follows: Use the function split to divide a string into multiple words in a certain mode:
I. Definition
Child
Program That is, to execute a separate section of a special task
Code It can reduce repeated code and make the program readable. In Perl, subroutines can appear anywhere in the program. Definition method:
Sub subroutine
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 $0 remote IP (default 127.0.0.1) remote_port (default 1988)
5. # type 'exit 'to exit or press enter to gain
Introduction to regular expressions in Perl
I. IntroductionIi. Matching Operators3. Special characters in the Mode1. Character +2. characters [] and [^]3. characters * and?4. escape characters5. match any letter or number6. Anchor Mode7. replace
The current project has just completed the compilation link of all components, and it is okay to run it.
However, you have to double-click six programs (four window programs and two command line programs) each time you run the program ).
I just want
Figure:
Copy codeThe Code is as follows :#! /Usr/bin/perl
#
# Fdupe tool-finding duplicate files
#
# $ Id: fdupe, v 1.7 20:11:21 root Exp root $
#
# Source code Copyright (c) 1998,2011 Bernhard Schneider.
# May be used only for non-commercial cial
Program comments in Perl: single-line comments and multi-line comments
(1) single line comment:All rows starting with # are considered as comments by perl. But with one exception, the first line of the perl program starts with #. It specifies the
Why use references?
In perl4, the value field in the hash table can only be scalar, not list, which is inconvenient in some cases, such as the following data:Chicago, USAFrankfurt, GermanyBerlin, GermanyWashington, USAHelsinki, FinlandNew York,
Here are two examples for your reference.
Record the function running time for any function.
Copy codeThe Code is as follows :#! /Usr/bin/perl
Use warnings;
Use strict;
No strict "refs ";
Sub testLogToStd {
Print "Test stdout: \ n ";
Open LOG, ">
However, awk, a commonly used tool in linux, is naturally friendly to Column Operations. Sometimes it is more convenient and effective to call awk directly in perl than to write the corresponding perl script. For example, use system to insert an awk
1. Open and Close files
The return value of open is used to determine whether the file is successfully opened. If the file is successfully opened, a non-zero value is returned, and zero is returned if the file fails. Therefore, the following
$ Can also match \ n
For more information about Perl, see page 132. Note 6.
1/^. * $/can it match "\ n? Yes! Because $ not only matches the end of a row, but also matches \ n2/^. * $/can it match "B \ n? Yes !. B matches. \ n matches $3/^. * $/can
Operate (generate) Excel on Linux or Unix. CPAN provides the Spreadsheet: WriteExcel and Spreadsheet: ParseExcel modules.
Let's take a look at how to use Spreadsheet: WriteExcel and Spreadsheet: ParseExcel.
First, install the corresponding modules
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