1 effectsBatch Modify file name2 usageRename [switches|transforms] [files]3 parameters-H,--help help.--man View the manual.-0,--null allows the file name to be read from the standard input.-F,--force the file that already exists when the renamed
#! /Usr/bin/perl-W use strict; Use 5.010; sub getdigit ($) {# Get digit from num my ($ num, $ flag) =@_; return $ num/(10 *** $ flag) % 10; } sub radixsort ($/@) { my ($ size, $ ARR) = @_; my @ sortarr; my $ I; my $ K; for (0 .. 3) { my @
Implicit inheritance in Perl
Implicit inheritance
Today, I saw a disconnection. Code : A. PM Code: [copy to clipboard] Package; ... Sub test {Print "test \ n ";} B. PM Code: [copy to clipboard] Package B;Use; B-> test (); I think it is
Perl $ sig {alrm} processing service timeout #! /Usr/bin/perl some_sub (); sub some_sub { eval { Local $ sig {alrm} = sub {die "died in SIG alrm ";}; # timeout processing alarm (1); # If the following Code is not completed after 1 second, the
Recently, I was writing a long Perl script to automate the process and steps for task execution. However, there are some easy-to-error steps, such as my VPN is not enabled or the XX service is not started, so some operations cannot be executed,
A routines method in CGI. PM calls 1. cgi. PM to implement two usage methods: Object-oriented method and traditional perlmodule method. Object-oriented Method :#! /Usr/local/bin/perl-W use CGI; # Load CGI routines $ q = CGI-> New; # create new CGI
Basic usage # initialize % H as an empty array % H ={}; # use an array to initialize % H as a => 1, B => 2% H = ('A', 1, 'B', 2); % H = ('A' => 1, 'B' => 2); # If the key is a string, % H = (a => 1, B => 2) can be omitted. # Use {} to access print "$
We often use a program in Linux to add parameters. Now let's take a look at the functions related to control parameters in Perl. getopt. in Linux, there are two types of parameters. one is -- help, and the other is-H. that is, the difference between-
######################### 1001 ############## ################
Use 5.010; while (<>) {my @ num = split; say $ num [0] + $ num [1];}
######################### 1048 ############## ################
My $ n = 12; my $ sum = 0; while ($ n --) {chomp
When Perl evolved to Perl 5, we had to consider the original hash design: the hash key value must be a scalar. The solution is to use 'quot '.
A 'quot' is a scalar value pointing to a complete list or a complete hash (or pointing to something else,
Use format and common methods (general methods for parent class IO: handle and IO: file are not described below ):========================================================== ========================================================== ==================
Conversion from: Protocol (Practical Extraction and report language), PHP (Hypertext Preprocessor), ASP (Active Server Pages), JSP (assumerver pages) for some technical comparison. Perl (Practical Extraction and Report Language) is a very old
Use sysopen () for more control--------------------------------------------------------------------------------To better control the file opening method, you can use the sysopen () function:
Use fcntl;
Sysopen (FH, $ filename, o_rdwr | o_creat, 0666)
Today, I saw an article about passing references in parameters. I mentioned a problem. I have encountered it before, but I used other methods to bypass it.
You can solve this problem by passing parameter references. So I plan to write it down. Hope
Recently, we have been struggling with the issue of how to release memory in Perl. Below are a few simple statements:
1. Perl-e 'for $ I (1 .. 10000) {$ hash {$ I} = 0; print "$ I \ t $ hash {$ I} \ n"; Delete $ hash {$ I };} for $ J (10001 .. 20000
Use XML-writer
#! C:/perl/bin/Use XML: writer;Use IO;# Open file stream. Param is file name.My $ output = new IO: file ("> output. xml ");# New A output stream.My $ writer = New XML: writer (output => $ output)Or die "create fail ";Print "file
Vars in perl is a pragma (precompiled indicator) in perl that is used to predefine global variables. These predefined global variables are in the qw () list, it can be used in the entire referenced perl file. Even if you use strict, no error is
I. Process processing functions
1. Process startup Function
Function Name eval
Call the syntax eval (string)The description regards string as a Perl statement execution.After the command is correctly executed, the system variable $ @ is an empty
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.