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 &
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.
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.
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
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
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
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
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
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 \
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,
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
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
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 $
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
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