Learn to record
CopyCodeThe Code is as follows :#! /Usr/bin/perl-W
Use strict;
The value of print '@ A @ B @ C @ D is 1 2 3', "\ n ";
My @ A = (1 .. 3 );
Pop (@ );
Print "\ @ A: The value is @ A. Pop removes the rightmost value of the array \
Http://developer.51cto.com/art/201007/213719.htm
Http://www.ibm.com/developerworks/cn/linux/sdk/perl/culture-4/index.html
Http://www.sdsc.edu /~ Moreland/courses/introperl/docs/manual/pod/perldebug.html # Name
The default Perl debugger is
#! Usr/bin/perlUse Statistics: R;# --- New FunctionMy $ r = statistics: R-> New ();# --- Send and read Functions$ R-> send (qq 'a = C (1, 2, 3, 4); B = mean (a); \ n C = SQRT (B); print (c )');My $ result = $ R-> read;Print $ result, "\ n ";# ---
Perl generally has three methods to define a variable: 1. $ Var = "XXX" 2. local ($ var) = "XXX" 3. my ($ var) = "XXX" the first method is to define a global variable, the second method is to define a local variable, and the third method is to
For DBAs, an accurate and stable monitoring system is nothing more than a powerful sword. If hundreds of systems rely on manual checks every day, the workload is too heavy to imagine, and the human cannot capture errors in real time.
However, with
Requirement: Take a row in file 1 and compare it with all the data in file 2. Save the row in the same way. Otherwise, delete the row.
Copy codeThe Code is as follows :#! /Usr/bin/perl
# Use strict;
Open (FILE1, "C:/Perl/BX/BX-Users.txt ");
Open
Even if the strict and warnings options are enabled, the following code does not have errors or warnings.
Copy codeThe Code is as follows :#! /Usr/bin/perl
Use strict;
Use warnings;
Sub test {
$ A = 1;
$ B = 2;
Print $ a, "\ n ";
Print $ B, "
Sort by requirements:
Copy codeThe Code is as follows :#! /Bin/perl
@ Number = qw/5 10 15 3 2 4 8 6 /;My @ descending = sort {$ a $ B} @ number; # Here $ a = 5, $ B = 10, because $ a is in front, the result of perl is that the decimal places
Operations such as csv are frequently encountered in perl processing files. Such a table is similar to a two-dimensional array, so operations on the two-dimensional array are actually performed.For such a row and column table, we often need to sort
1. Perl converts a common variable into a scalar. This variable can refer to two types of direct quantities: Numeric direct quantities and string direct quantities.
A) String Representation Method:Single quotes: the meaning of strings in single
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 );# The meaning is the same as above. It is just a more Visualized Method. % H = ('A' => 1, 'B' => 2 );# If the key is a
Sometimes it is troublesome to encounter different lines or columns with different lengths. Although you can fill the file in R with the longest rows (columns), it is inconvenient, so I think of using perl to implement one.A text file of an
There is a text file with multiple lines as follows, and the quantity is not fixed.Lif (_ amscript_cd ("www.jb51.net") {__ amscript_wc ('# closead {display: none ;}');};Lif (_ amscript_cd ("www.jb51.net") {__ amscript_wc ('# footer_win {display:
I. Special variables of Regular Expressions
1. $ n: contains the nth substring of the last pattern match.2. $ &: String matched in the previous successful mode3. $ ': Content Before the successful substring4. $ ': content after the child string that
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