The main use is to find the related files in the/proc directory.
#!/usr/bin/perl use
strict;
Use warnings;
#usage: process_grep.pl processname
exit (Main (@ARGV));
Sub Main {my
$Phash;
my $ProcessName = shift;
My $PROC _dir = "/proc";
Scripting function: To detect the specified domain name by using ICMP ping or Tcp/syn to detect the validity of the domain name before probing.
file:check.host.pl #!/usr/bin/perl use strict;
Use Net::P ing;
Use Net::D ns;
Use Time::hires qw ();
Sort by Requirement:
Copy Code code as follows:
#!/bin/perl
@number =QW/5 10 15 3 2 4 8 6/;My @descending =sort {$a $b} @number; #这里 $a = 10, because $a was previously, the result of Perl was decimal in the previous, or ascending order.
There is no bool type in PerlThere is no bool type in Perl, and all judgments are made by numeric types and string types.What type is FalseThere are only three scalars, the number 0, the empty string "", and the string ' 0 ' ("0").The vector has an
Requirements : Some of the RESTful APIs have been implemented to remove the value of some key from the return value of the RESTful API by invoking the RESTful API.1) in rest, each object is a 1 URL;Here you need to know how Perl sends the request
Replace with s/// : If you think of m// pattern matching (pattern match) as the word processor's "find" function, then The s/// replace (substitution) operator is the "Find and replace" function. This operator simply replaces the part of the
To define a sub-program :To define your own subroutine, you can use the keyword sub, the subroutine name (not including the number), and the block of code enclosed in curly braces, for example:1 Sub marine{2 $n + =1; # global variable $n 3
Arguments is the values you pass to a Perl script. Each value on the command line after the name of the script is assigned to the special variables$ARGV [0],
$ARGV [1],
$ARGV [2], and so on. The number of arguments passed to the script
1. Chop and chomp Functions
Both functions use strings as parameters and remove the last character from them. The difference is that, no matter what the last character is, chop will be removed and returned in the return value. Only when the last
Original article address:Http://blogread.cn/it/article/743? F = WB
I used Perl to write some monitoring scripts and put them in crontab for scheduling and execution. Sometimes you will find that a script runs for too long and starts multiple
Perl supports generating documents from text blocks in your pod format. This pod text block can be embedded in
CodeOr a separate file.
With the pod, It is very convenient to write a script without having to write additional documents.
We
1. Open and Close files
The syntax is open (filevar, filename), where filevar is the file handle, or is
Program Is used to represent the code of a file. filename is the file name, and its path can be relative or absolute.
Open (file1, "file1
I. Condition Determination
If ( ){
}
Elsif ( ){
}
...
Else {
}
Ii. Loop:
1. While Loop
While ( ){
}
2. Until Loop
Until ( ){
}
3. For Loop of class C, such
For ($ COUNT = 1; $ count # Statements inside the loop go here
}
The following is an
1. Tag extraction in HTML
])*>
2. Extract the URL and link text in the label.
While ($ html = ~ M {A \ B ([^>] +)> (.*?) }ig) {my $ guts = $1; my $ link = $2; if ($ guts = ~ M {\ B href # href attribute \ s * = \ s * # A blank character (? : #
Writing intention:The built-in netstat in Linux system often finds that CPU consumption is high when capturing information, especially when some monitoring systems are used,It is found that if netstat is used, the monitoring system itself will cause
Making references
References can be created in several ways.
By using the backslash operator on a variable, subroutine, or value. (This works much like the & (address-of) Operator in C.) This typically createsAnotherReference to a variable, because
I am very grateful to superor for taking his own time and providing the first Chinese video tutorial for the Chinese Perl community. It is a good tutorial in other languages. Compared with Perl, Perl is still relatively small. It is quite convenient
How to generate exe for your PERL script ?, Generateperl
The way I am using is PAR Packer.
1. Downloadmodule PAR Packer:
Http://search.cpan.org /~ Rschupp/pars-packer-1.024/lib/PAR/Packer. pm
2. InstallPAR Packer:
2.1Unzipthe *. tar
2.2Go tothe
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