Compiling DBDPerl is often used in projects, but Perl needs to rely on the DBI,DBD driver when connecting to the database, but it relies on the Lib library of the database when installing DBD drivers by default.For example, Perl is connected to
The script takes the JSON configuration file, can be customized, backup directory, full backup cycle, incremental backup time, etc.JSON configuration file:{ "Backupdir": "/data_backup", "Archivedir": "/archive_dir", "original": " /www/", "
The 12th chapter: Regular ExpressionsA regular expression is a sub-program. is the text matching subroutine. Yi Wu.Be sure to use the/X flag. Yi Lu.be sure to mark with/M. One restaurant Qi.use \a and \z as the string boundary anchor point (anchor).
When debugging a Perl program, it is very convenient and effective to use the Smart::comment module to track the variable values of the code.code example:1 # !/usr/bin/perl 2 3 Use Smart::Comments; 4 # no smart::comments;5 my $var=@ARGV[0]; 6 7 # #
Alex Suykov had do some work for this purpose, and my compile script was based on her patch.Stepsstep 1:Download Perl source code from Perl ' s official site, such as:
wget http://www.cpan.org/src/5.0/perl-5.20.2.tar.gz
Step 2:Download
ProgramFile: test. pl
CopyCode The Code is as follows :#! /Bin/perl
# Filename: Test. pl
Use strict;
Use warnings;
# Search for a sequence that is better recognizedMy $ DNA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ n ";My $
The following is an example:
CopyCode The Code is as follows: use strict;
# Here are two Arrays
My @ I = ('1', '2', '3 ');
My @ J = ('A', 'B', 'C ');
# Print them out before processing them and see what they look likePrint "in main program
Comparison of Perl use and require usage
Comparison (1) Description:Both functions mean loading and referencing Perl modules, or sub-functions.Program,
The difference is that Perl use is searched in the current default. Once the module is not in
Recently, when running in a local environment using Perl, I need to enter a device name to determine the next step. Every time I run it here, I enter a long device name manually, for example, ciscocontenteng. Every time I input such a name, it is
Recently, due to project requirements,
One tool needs to be completed in multiple old Linux/UNIX versions. Some of them do not have python, so they have to regain the Perl documentation ......
Reading the Perl document is a process of vomiting
Null Value Judgment
$ T {type1id }=$ $ Pref {DBH}-> selectrow_array ("select type1id from enq1 where id =
3 ");
If ($ t {type1id} = 0 ){
Print "type1id is null \ n ";
}
==> This statement is incorrect if it is not a numerical value. Special
1. Replacement
S/pattern/replace/; # returns the Boolean value of whether the replacement is successful.
You can use capture variables, such as S/(\ W)/$1/
If the matching fails, no processing is performed.
2. delimiters
For delimiters without left
1) is the URL Legal:/^ (http: \/| https :\/\/)? ((? : [A-Za-z0-9] +-[A-Za-z0-9] + | [A-Za-z0-9] +) \.) + ([A-Za-z0-9] + )[\/\? \:]?. * $/
2) When to escape: 1. For example, if you want to use "in" ", then \"; 2. Some special characters
3) database
For the original English version, see http://www.masonbook.com /.
Introduction
Mason is a powerful template engine that can embed Perl into text. It provides many features to help you use reusable components to create dynamic web sites. In addition,
Trusted CT. PM module: Mainly used to interact with another server, such as FTP and telnet. It is also frequently used in writing monitoring data.The method I used is very simple,Spawn ($ command, @ Params), forks and execs $ command. returns an
Copy codeThe Code is as follows :#! /Bin/perl
Print "please input some lines, then press Ctrl + Z. \ n ";
Chomp (@ s = );
Print "1234567890" x 3. "\ n"; # serves as a yardstick for output results.
Foreach $ s (@ s)
{
Printf "% 20s \ n", $ s; # The
This module uses the perl array to represent a file. each row of the file corresponds to an element of the array. The first behavior element is 0, and the second response is 1 ,...The file itself is not actually loaded into the memory, and the
1. Statement block:The parts between {} Are BLOCK statement blocks.
2. Condition Statement:If (expression) BLOCK;
If (expression)BLOCK1Else BLOCK2;
If (expression1)BLOCK1;Elsif (expression2)BLOCK2;ElseBLOCK3;
# Inverted if statementExpression if
Let's take a look at the usage of our.
Require 5.006If the version number is less than 5.006, a failure is returned, causing the module to fail to be loaded.Therefore, it is used to ensure the Perl version of the module call environment.
Like my,
1. perl ~~ For intelligent matching, it can intelligently Determine operations based on the operands on both sides of the symbol.
To determine whether an element exists in an array, do not use smart matching. The program is like this:
my $x=2;my
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.