This article mainly introduces Perl delete leading and trailing blanks (remove left and right spaces, white space characters), this article gives a number of methods to achieve this requirement, the need for friends can refer to the following
In
As with most other programming languages, Single-line comments in Perl also begin with a #, such as:
Copy Code code as follows:
#print "hello,world!";
But multiline annotations, different languages have different ways of
Although it is recommended that you turn on warnings in every Perl script and module, you do not want users to see a warning from Perl.
On the one hand you want to use using warnings as your safety net in front of the code, on the other hand,
First, open, close the file
Syntax is open (Filevar, filename), where Filevar is a file handle, or the program used to represent a file code name, filename is filename, its path can be relative path, can also be absolute path.
Open (FILE1, "file1");
Arithmetic operators: + (plus),-(minus), * (multiply),/(except), * * (Power),% (take more),-(Monocular negative)
(1) The cardinality of the power can not be negative, such as ( -5) * * 2.5 # error;
(2) The result of power can not exceed the limit of
Perl has begun to use UTF8 coding internally to represent characters from 5.6, meaning that the processing of Chinese and other language characters should be completely free of problems. We just need to take advantage of the Encode module to give
This article is focused on the Perl hash table concept, Perl and other programming languages have their own characteristics, here and you share the concept of Perl hash table, in fact, Perl hash table is a structure.
Perl Hash TableA Perl hash
1. Statement BLOCK:The section between {} is block statement blocks.
2. Conditional statement:if (expression) block;
if (expression)BLOCK1else BLOCK2;
if (expression1)BLOCK1;elsif (expression2)BLOCK2;ElseBLOCK3;
#倒置的if语句Expression if
Perl substr () Function example, substr () function instance code-returns the substring of expr, starting with offset within the string.
Grammar:
Substr EXPR, OFFSET, LEN, replacementSubstr EXPR, OFFSET, LENSubstr EXPR, OFFSET
Definitions and
If control structure
Chomp (My $a = ); User input variable $a value
if ($a > 0) { If $a is greater than 0 executes command
print "$a is larger than 0\n";
}
elsif ($a = = 0) { if $a equals 0 then execute command
print "$a
Perl is a very flexible scripting language. There is also a demand scenario for reflection. Reflection is the conversion of a string to the corresponding language object.
(Do not consider the ultimate kill technique such as eval) 1. Reflection as a
The script iterates through the files in the directory and replaces the target string with a regular expression match.#!/usr/bin/perl-wuse strict;# Trave Target directory and modify files under it.# Modified files are matched using regex.# # v1.1use
This article will describe the following aspects: 1. What is Perl 2. What is perl for? 3. Construction of Perl environment under Windows 4. Perl Version Hello World 5. Perl Grammar Synopsis 6. Some reference materials
What is Perl
Script is very practical and can simplify manual operations. The following script deletes the log files from the previous seven days.
Bat script:
@ Echo Off Echo ------------ Delete log file, Develop by Terry ------------- Echo Today Date ::%
I don't know why I wrote this log. Maybe Matlab is rarely used in Linux in the future, and this Perl and Matlab interfaces will not be used.
After the installation is complete, simply record the process.
For the installation of Matlab, please refer
I. file input/output functions
1. Basic I/O functions
Open: Allow programs to access files
Close: Terminate File Access
Print: file write string
Write: Write the formatting information to the file.
Printf: format the string and output it to the
When using Linux or UNIX, Perl is a very useful scripting language. There are many introductions on Perl module installation on the Internet. On the one hand, you can install it using software installation tools provided by different kits, on the
Http://hi.baidu.com/0soul/blog/item/91098701f5051880e850cd4b.html
Original article: http://www.perl.com/pub/a/2002/08/20/perlandlwp.htmlThere are a lot of copyright information, and I will write the rest at the end.I think this Perl LWP document is
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.