Built-in variable $_:Let's take a look at an example:
Copy Code code as follows:
#!/usr/bin/perl-w
@array = QW (a b c d);
foreach (@array) {
Print $_, "";
}
The role of an example is to define an array and print out the
1 Line PerlPerl, for today, has only one line of Perl programs.Perl is famous in a variety of programming languages, such as I, who often write Perl programs that I can't read.For example, the program in this document, although short, estimated one
Basic usage
#初始化%h is an empty array%h={};#用数组初始化%h for A=>1,b=>2%h= (' A ', 1, ' B ', 2);#意义同上 is just another, more figurative way of writing. %h= (' A ' =>1, ' B ' =>2);#如果key是字符串, you can omit the quotation marks. The following line is the same
Often encounter downloaded files or e-books, the name contains a number of web site information, the actual use because the name is too long inconvenient, the following script uses regular expressions to rename all the files under the directory:For
With regard to the multi-process of Perl, you may soon think of parallel::forkmanager this module. But today we try to write a similar frame ourselves:)This multi-process development model LIGHTTPD from the Open Source server framework, the core
Functions (subroutines):The function brackets in Perl can be written or not, unless the implications are not written.Customizing the subroutine:Sub function-name{Expressions}The return value of the subroutine:All Perl subroutines have return values,
This article will present the most commonly used four dynamic Web Language Perl (Practical Extraction and report Language), PHP (hypertext Preprocessor), ASP (Active Server pages) , JSP (JavaServer Pages) for some technical comparisons.PerlPerl
The array element in Perl starts with a reference ordinal of 0, the first element of the @array is $array[0], increments sequentially, and the last element is $array[-1] or $ #array. If you want to delete an existing element in an array, you can do
There are many ways to read the last line of a file in Perl, such as(1) Read the file into the array and take the last elementOpen (FILE, "file.txt") or Die "$!"; My @arr =;; Close File;my $last = $arr [$ #arr];# $last is the last line of content.(2)
In the process of building Elasticsearch database, the first use of its recommended Logstash tools to import data, but it is very uncomfortable to use, so you want to use Perl good regular expression to filter the data classification, and then
Fourth chapter: Values and expressionsData is lacking in anger ...A bit like a programmer.-arthur Norman 0 three.inserts with string qualifiers are only used for strings that are actually inserted. L Create string literals and want to insert
1) Remember just beginning to write Perl, for a function, always take the current data types can be used to solve the problem, do not want to think there is no better, can be used to solve the problem is good, which led to the late, to add
The translation respects the original and maximizes the original content in its own way. For more information, please visit www.from0701.com. Two chapters are updated weekly.Welcome to the next stage of Perl learning. The reason you're here may be
Because there is a project in the work that needs to crawl the content of a third-party site, a simple crawler is written under Linux using Perl.Related tools1. httpwatch/Browser Developer ToolsIn general, this tool is not available, but if you find
The I am using is PAR Packer.1. Downloadmodule PAR Packer:http://search.cpan.org/~rschupp/PAR-Packer-1.024/lib/PAR/Packer.pm2. Installpar Packer:2.1 unzipthe *.tar2.2 Go tothe directory and run "Perl makefile,pl", if you is using Active Perl, you
Method 1:
Maven is used to build an application in the past two days, there are more than 700 pom. XML file, even more depressing is in many pom. the URL of the resource library is specified separately in the XML file. I need to uniformly
1 line PerlSpeaking of Perl today, there is only one line of Perl Program .Various Programming Language Perl is famous for its abnormal ancient spirit. For example, I often write Perl programs that I don't understand.For example, although the
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-and.
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