Perl's operations on files are similar to those of other languages, nothing more than open, read, and write operations.1. Open the file
#! C:/perl/bin/perl-w use
UTF8;
Use strict;
Use warnings;
My $filename = ' test.txt '; # or with an
PPM (Programmer ' Package manager) is a graphical management tool with ActivePerl, and with this tool, it is convenient to upgrade, update, and remove the Package from Perl. You can open the graphical interface simply by entering the PPM or ppm GUI.
#!/usr/bin/perl-w use
strict;
Use File::spec;
Local $\ = "\ n"; #当前模块的每行输出加入换行符 my
%options;
#目录路径
$options {single_case} = '/home/jiangyu/src/pl/example ';
my @cases;
if (-D $options {single_case}) {#判断目录是否存在 my
@files;
my $dh;
I. Definition
A subroutine is a separate piece of code that performs a special task, which makes it easy to reduce duplicate code and make the program readable. In Perl, subroutines can appear anywhere in the program. The method is defined as:
Sub
The program calls the remote service, in order to ensure that availability is best done before the use of health testing, the exception of the service excluded.
Copy Code code as follows:
#!/usr/bin/perl
#
Use strict;
Here is an example:
Copy Code code as follows:
Use strict;
#这里是两个数组
My @i = (' 1 ', ' 2 ', ' 3 ');
My @j = (' A ', ' B ', ' C ');
#在进行处理之前, we'll print them out and look at them.Print "In the main program before calling
Here for you to give two small examples for friends to learn a reference.
Record the time that the function was run on any function.
Copy Code code as follows:
#!/usr/bin/perl
Use warnings;
Use strict;
No strict "refs";
Sub
Special symbols for Perl
@ Array$x {} x preceded by a dollar sign ($) followed by a curly brace ({}), it is a hash element% to reference the entire hash, using the percent sign (") as the prefix. The hash used in the previous pages is
For example:
Copy Code code as follows:
Unless ($fred =~/^ ([a-z_]\w*$/i) {
Print "The value of \ $fred doesn ' t look like a Perl identifier name. \ n ";
}
Using unless means either the condition is true or a block of code
Reference Link: http://stackoverflow.com/questions/841785/how-do-i-include-a-perl-module-thats-in-a-different-directory Http://stackoverflow.com/questions/185114/how-do-i-use-a-perl-module-in-a-directory-not-in-inc
In Fedora/rhel/centos, the
In the text processing often encounter this situation: there are a number of files need to modify the contents, but also want to retain the contents of the original file. This time Perl provides a handy variable $^i, after you save the suffix for
Loop control:1.lastStatement block for Exit label2.next3.redoNot recommended, cycle times are not controllable4.gotoNot recommended.***************************************Label:Define a label firstLast|next|redo|goto label;Last VS next corresponds
51 Leisure, read a Perl instance of the Fine Solution (4th edition) of the ebook, this is the last example of the 19th chapter. Practice practiced hand to reward yourself for learning the process of knowledge.The following source file is the file to
Yum installs Cpan and YAML-related packages:Yum Install Cpan perl-yaml*Update Cpan to the latest version and reload CPAN:[[email protected] ~]# cpan Enter ' h ' for help.cpan[1]> install cpancpan[2]>reload CPANModify the site of the CPAN Mirror
I recently started to learn shell + sed + awk.
Linuxsir. orgSee the following comments
ArticleTo make it easy for more people to see it! Shell + sed + awk
The three features are the weakest and not debugged.
ProgramMost operations can be
Chomp can remove a line break from the end of a string. This is basically all the functions it can accomplish, as shown in the following example:$ Text = "a line of text/N"; # It can also be input by Chomp ($ text); # Remove the line break (/N ).It
Perl uses a variable called the file handle type to operate files; perl uses a file handle to establish an I/O channel between files in the program and external memory that can exchange data with external storage media. We recommend that all file
Apache and CGI are not explained here.1. apache download address: http://www.apache.org, the following uses 2.0.63 as an example to introduce the configuration of running CGI program.2. Download the Perl interpreter ActivePerl in Windows. Official
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.