Notes in Perl

Here are some notes for learning and using Perl. List one item today:1. Analyze the Matching content of the following regular expression /^/B [/W.] {1, 12}/B $/   Answer: This regular expression matches a line that starts with a character and

Perl obtains the external IP address of the local machine.

Note:Read the output of the "netstat-p tcp" command, extract the data in the foreign address section, and count the multiple connections of the same IP address. Advantages:Compared with the output of the netstat command, you can more intuitively

Perl hash output sorting

Sort Function Sort list Sort Block List Sort subname list The usage of sort is as follows. It sorts the list and returns the sorted list. If the subname or block is ignored, sort is performed in the standard string comparison order (for example,

PHP cannot read Perl serialized objects stored in memcached.

The client serialization object of Perl memcached adopts the nfreeze method of the storable module, which calls the C extended do_store method. The deserialization uses the thaw method of the storable module, this method is the do_retrieve method of

Perl: Non-Greedy quantifiers

Example: Assume that/Fred. + Barney/is used for matching on Fred and Barney went bowling last night. We know the regular expression. Next we will explain this process in detail: first, the sub-mode Fred will match the corresponding string. The next

Some functions about strings in Perl

Search for substrings: Index () and rindex () These two functions are used to find strings in strings. The rindex function is the same as the index function, except that it is located later.There are two main usage options: Index ($ string, $

Perl: file operations, my, time conversion, log monitoring

① File Operations To read a string from a file using Perl, you can use either of the following methods:1. Read all the content in the file into an array at a time (this method is suitable for small files ): Code highlighting produced by Actipro

Perl language learning-from C/C ++ to Perl

Use strict;Use warnings;# Compare the value and string sizeMy $ str1 = "1-the first Str ";My $ str2 = "1-the second Str ";If ($ str1 = $ str2){Print "numerically equal \ n ";}If ($ str1 EQ $ str2){Print "stringwise equal \ n ";}Print "A. B". "Haha"

Perl function pointer

It seems thatCode, Passed the test # ! /Usr/bin/perl Sub Func1 { Print " Func1 is running \ n " ;} Sub Func_test { My $ Func_ref = Shift ; # Ref will return 'code' if it's function reference If (( Ref ( $ Func_ref ) Eq " Code

Install SQL-related modules in Perl on Mac OS-Based on DBI and DBD: Sybase

Mac OSLowerPerlLinkSQLInstallation of related modules(Notes) --Based onDBIAndDBD: Sybase Preface: This article is a supplement to . It mainly explains how to install Perl DBI and DBD modules in Mac OS. This article is based on

Getting started with Perl

Reference webpage: http://man.ddvip.com/web/perl/perl1.htm #======================= ===================================================== # variable add $ above; #0 headers in octal; 0x headers in hexadecimal format; $ value1 = 047; $ value2 =

Use Perl for system service monitoring and alarms

Generally, Web sites include many services and applications. We cannot know whether the system is running normally in real time, especially when the server goes down or the application goes down at night, will affect the business andDuring user

Perl gets multiple rows after matching rows

#! /Usr/bin/perl Use warnings; Use strict; My $ flag = 0;My $;While () {If (/^> /){$ Flag = 1;$ A = 0;}If ($ flag){Print $ _;$ A ++;}If ($ A = 3){$ Flag = 0;}}############! /Usr/bin/perl-WUse strict;Open (logout, "> out. log") or die "can't create "

Implementation of Perl Object-Oriented Programming

Reason Looking back at Perl recently, on the one hand, my customer manufacturers developed a lot of things with Perl, on the other hand, they reviewed the Perl language and had some experiences. Record it for your reference. I am working on a small

Learning Perl Chapter 1 Exercise answers

Posted on Netease blog 21:22:33 3.1 list Printing # When reading each list value from stdin, it is processed by chomp. Therefore, each list element is removed from the line break at the end.Chomp (@ lines = );Print "print the list \ n ";Foreach $

Perl sort Functions

1) sort function Sort listSort Block ListSort subname list The usage of sort is as follows. It sorts the list and returns the sorted list. If the subname or block is ignored, sort is performed in the standard string comparison order (for example,

[Perl] Perl statement for case condition judgment

Method 1: Use the Switch Package in analyticdb 5.8 Use switch;Switch ($ Val ){Case 1 {print "Number 1 "}Case "A" {print "string "}Case [1 .. 10, 42] {print "number in list "}Case (@ array) {print "number in list "}Case/\ W +/{print "pattern "}Case

Perl Excel file and TXT Conversion

Excel2txt. pl #! /Usr/bin/perl Use strict; Use Spreadsheet: parseexcel; My $ oexcel = new spreadsheet: parseexcel; Die "Usage: \ n \ tperl $0 xls.txt \ n" Unless @ argv; My $ obook = $ oexcel-> parse ($ argv [0]);My ($ IR, $ IC, $ owks, $ owkc

Perl extracts wtmpx logs and writes Recent user logon information to syslogs.

Background: Perl reads wtmpx log files; Logger command; Syslog log; Crontab command; Reference books: Perl Network Programming Help: SYS: syslog module processes system logs compilation warning: Your vendor has not defined the SYS: syslog

Perl-Chapter 3-list and array-Exercises

1. Question 2. Code1 #-----------------------------------------------------------# 2 # Source: Learning Perl, chapter3 3 # Date: 2012-01-13 4 # Author: xiaodongrush 5 #-----------------------------------------------------------# 6 # code-1 # 7 #----

Total Pages: 66 1 .... 62 63 64 65 66 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.