Perl command-line common methods

A. Original text replacementPerl-p-i.bak-e "s/source string/target string/g" The original text is backed up as a. bak suffix fileB. Regular packet Extractionecho "Tom and dic" | Perl-n-E ' @w =/(Tom). * (DIC)/; print "$w [0] & $w [1]" 'Print "Tom &

Perl Learning II: Simple variables

String variable: ${}1. Single quote: Do not replace the variable, do not escape, the string can cross the line.2. Double quotes: variable substitution (greedy matching principle), support escape character (escape character can be seen separately)3.

How to debug in Perl?

If It is a small program, you can use the this to:c:\rebecca\script\perl>perl-d calculate.plLoading DB routines from perl5db.pl version 1.39_10Editor support available.Enter h or ' h ' for help, or ' Perldoc perldebug ' for morehelp.Main::(Calculate.

Perl io:socket io:select Server Client

Server program Accept client information and send a response#!/usr/bin/perl-w# socket_server.plUse strict;Use Io::socket;Use Io::select;# hash to install IP PortMy ($ser _addr, $ser _port) = ("127.0.0.1", "12345");Our ($buffer, $len);My $socket

Learning Perl Learning Notes

1. File read-write and command-line parameters#!/usr/bin/perlUse strict;if (@ARGV Die "Usage:perl $ inputfile outfile\n";}My ($infile) = @ARGV [0];My ($outfile) = @ARGV [1];Open My $infile _fh, "," $infile "| | Die ("Can ' t Open the file!");Open My

Auto Build Environment with Perl/ant (2)

Today, we built a web environment, Apache + Perl, and mounted CGI to test the performance. However, we suddenly encountered several problems.The command line support for starteam cannot be found for listing all the projects of the company on the

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

How can Perl prevent scripts from being closed in a flash in windows?

When you first started learning Perl ProgramWhen you are ready to wait for the result to be output, double-click the result and you will see the screen flashing, and then there will be nothing left. You have no chance to see the output. How can

Introduction to Perl pop push shift unshift instance

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 \

Introduction to Perl (2)

The previous section describes the basic data types and usage methods in Perl. This section describes branch loop control and Io.   The syntax of the branch loop in Perl is similar to that in the C family language. The keywords include: If/else,

Perl: Time Functions

There are several time processing functions in Perl: 1,Time Function: Returns the cumulative number of seconds from January 1, January 1, 1970. Use: My $ t = time (); 2,Localtime Function: Get the local time zone Use: My $ T = localtime

Sample Code for searching for several sub-characters (strings) in Perl

1) how to find the number of times a character appears in a string? Source: http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q4.24.html If you want to find the number of occurrences of a character (x) in a string, you can use the tr // function and

Common Perl syntax records

Common Perl syntax records ##包的切换和调用其它包的方式#package A;#my $a=10;#package B;#print $A::a;#print $a;  ##local局部标识符的使用#$aa=20;#{#local $aa;#$aa=10;#print "$aa \n";##}#print $aa;##别名的使用=comment$b=10;$a=1;$c=200;{local *b;*b=*a;$b=20;print "$a \n";}*d=*c;

[Zz] backslash escape table in double cited strings -- Perl

Structure Meaning \ N Line feed \ R Enter \ T Horizontal tabulation Operator \ F Page feed \ B Return \ V Vertical table feed \ Ring tones \ E ESC

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] 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-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 #----

Perl-Chapter 10-other control structures-Exercises

1. Question 2. Code and Output1 #-----------------------------------------------------------# 2 # Source: Learning Perl, chapter10, exercise-1 3 # Date: 2012-01-20 4 # Author: xiaodongrush 5 #---------------------------------------------------------

Perl skips the implementation code for reading files from the first line

Copy codeThe Code is as follows :#! /Usr/bin/perl Open (READ, "Readline READ; # skip the first line While ( ){ My ($ id, $ axis1, $ axis2, $ axis3, $ value) = split //; $ Line = sprintf ("% d ", $ Id, $ axis1, $ axis2, $ axis3, $ value, $ axis1

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.