Perl is a practical summary and reporting language that is popular with developers around the world, and although it was born and developed on Unix, it has a niche in the area of Windows programming.
Under the leadership of companies such as
Installing Perl in a Linux environment is really easy, but the reason I recorded here is because after the installation, there has been a problem plagued me, that is, I set up the installation directory has always been not effective, I always
CPANM is the most convenient way to install Perl modules. Automatic Download installation Dependency pack. Using the CPAN shell or download source package to install the module, encountered a lot of dependencies, very headache. Here's one example:
The main function of the SSH limit perl script is:1. Limiting the maximum number of logons for an SSH user is n,n customizable.2. Support White list, such as root, test login is not restricted.
If an SSH user's maximum number of logons exceeds a
The most common use of Perl is file processing, and here's a summary of some of the things that Perl files do, and a concrete example that reinforces our understanding of Perl file operations with the example below.
deleting files
Use the Unlinke
1. Chop and Chomp functionsAll two functions take a string as a parameter and remove the last character at the end. The difference is that, regardless of the last character, chop is stripped and returned in the return value, and Chomp is stripped
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,
#!/usr/bin/perl-w Sub npoint{My $CodeStr = $_[0]; Print $CodeStr. $/; my $CodeLen = 32; My $CodeSpace = $CodeLen-length ($CODESTR); if ($CodeSpace >= 1) {$CodeStr. = CHR) x $CodeSpace; } My $NewCode = 1; My @
In general, the timeout setting in Io::socket::inet is for ConncetIf you want to set the RECV receive timeout, you can set this:1UsrSocket:2......3 setsockopt($socket, Sol_socket, So_rcvtimeo,Pack('l!l!',1,0));4 #Note that there are three parameters
Summarize: Q (), QQ (), QW (), QX (), respectively, are single quotes, double quotes, create string lists, and capture command output. 9th hours other functions and operators
One thing can be done in a variety of ways. The main contents of
In PerlThere are two ways of system invocation, one is System (CMD) and the other is ' system 'Never noticed before, the difference between the two ways, and thought it was the same,When I write a script today, I suddenly want to get the return
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/", "
Perl scripts as a standalone process at run time, invoking another script means creating a child process, which is fundamentally different from a function call, which is a process in which a separate code is executed. This is a special need to pay
[root@localhost mha4mysql-node-0.52]# perl makefile.pl;make;make Install Can ' t locate extutils/makemaker.pm in @INC (@INC contains:inc/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/
Chapter Two: Code deployment 00.the curly braces and parentheses are represented in the K&r style. ThatMy @name = (' Damian ',' Matthew ');For my $name (@names) {Formy $word (anagrams_of (LC $name)) {print "$wor \ n";}} 00 Ii.the control keyword and
Common Perl Functions
Command: PrintSyntax: Print filehandle listNote: This filehandle can be seen as a bridge between I (input) and O (output). You can use filehandle to read and write data. stdin indicates the connection from which data is input,
Symbol tableEach package has its own symbol table, which is a hash table. The keyword is the variable name, file handle, directory handle, and subroutine in the package. The value is typeglob.
Each symbol is assigned a typeglob (* X), which
Previously, I did not pay much attention to my blog. I felt distressed when I lost my blog. Now I am paying attention to it and decided to regularly back up SQL statements. Write a script as follows:
Copy codeThe Code is as follows :#! /Usr/bin/perl
When you upgrade webmin, the following message is displayed:Error-Perl execution failedUndefined subroutine & WebminCore: translate_filenameCalled at/usr/libexec/webmin/web-lib-funcs.pl line 14.At this time, we can log on via ssh, rootYum-y upgrade
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