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
Method one, manual installation steps
Download the DBI Module version 1.13 of the compressed file dbi-1.13.tar.gz from CPAN, assuming it is under/usr/local/src/.Cd/usr/local/srcUnzip this file:Tar xvzf dbi-1.13.tar.gzA new DBI-1.13 directory is
When you write a script or install a program, you need to modify the specific file data, if there is the ability to automatically modify the file, it will be very practical. For example, when you need to move a string or command in a file, this
Install Perl modules to a non-custom directory
How does I get Makemaker and Module::build to install to the same place? Module::build, as of 0.28, supports, ways to install to the same location as Makemaker. 1) Use Install_base/--install_base
[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/
#!/usr/bin/perl-w UseStrict; UseFile::Spec;Local$\ ="\ n";#each line of output of the current module adds a newline charactermy %options;#directory path$options{Single_case} ='/home/jiangyu/src/pl/example'; my @cases; if(-D$options{single_case})
I. Password Verification:1. Install the Net: SSH: Perl module. For the installation method, see install the Perl module.2. In the example of automatic logon, log on to the server 192.168.0.100 using the testuser and run the DF command:
#! /Usr/bin/
1. Module source: Pack and download from CPAN together with the Perl release version
2. Read the module documentation: perldoc CGI
3. Installation Module
Makemaker mode:
Specify the installation directory:
Module: Build mode:
CPAN method:
1.> clear file data and overwrite;> append at the end of the file2. It is recommended that you close a file handle immediately, regardless of whether the program ends immediately.3. $! Indicates some readable information generated by the system,
Preface
Sometimes there are these requirements:
1. count the number of rows of a file
2. Calculate the number of valid lines of a source code. Exclude empty and comment rows
3. Unify the quantity and number of files in a directory
Many languages
Notice a great post on Reddit, the author listed some useful modules in it. I am excited for that Perl community always appears to be full of vitality and innovation that surprise us.
Below content is referring to
Submitted a question on stackoverflow just now.
I intended to extract content from a web page which contains character Unicode characters represented in the form of "% xx ". as I used Perl module lwp to get web page, naturally handled These unicode
"Our"," The name is limited to a certain range ", in fact, is to clearly declare a" global variable ", although defined in a module or function, can be accessed outside, if it has already been declared, use "our" again to indicate that the global
Reprinted this site article, please note, Reprinted from:
FukaiHttp://www.php-oa.com
Link to this article:
Http://www.php-oa.com/2009/04/04/perl_getopt-long.html
In Linux, we often use a program that requires adding parameters. Now let's take a look
This post compares the three methods of folder traversal.
1. Use File: Find;
2. Recursive traversal. (The traversal function is LSR)
3. Use Queue or stack traversal. (The traversal function is lsr_s)
1. Use File: Find[Copy to clipboard] [-]
Code:#!
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
This article only implements compilation, and calling WCF is not successful yet (the server digital certificate is called without authentication !)
1: Install ActivePerl (latest ActivePerl-5.12.2.1203)
Http://www.activestate.com/activeperl/downloads/
In Perl, you can use the open or sysopen functions to open files and perform operations. Both functions use a file handle (that is, a file pointer) to read and write files.
The open function is used as an example:
1. Open and Close files
The return
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
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.