Special variables in Perl
1. $&, $ ', $ ' used in pattern matching
$& is used to hold the value in the match$ ' used to hold all previous characters in match$' Used to hold all characters after the match
Such as:
#!/usr/bin/perl-w
If
"
Hello
1, send mail on an SMTP server that does not require authentication#!/usr/bin/perl-wUse NET::SMTP;$SMTP = net::smtp->new ($mail _server); #邮件服务器地址$smtp->mail ($send _user); #发件人$smtp->to ($recv _user); #收件人$SMTP->data ();$smtp->datasend ("Subject:
perl| Access | data | The database is not just vb.net,c#. Microsoft's development software can invoke the. NET Framework, as far as I know, at least 28 of the development languages I knew how to invoke. Net Framework. Let me give you a case of using
"Use POSIX": Sys_wait_h ";" Remove, and it is wrong to print the variables in the subprocess in the main process, the main process does not know the status of the child process, unless you pass the value of the variable to the main process with a
1.@_ is an array of parameters that are placed when a function is passed, and you can take arguments from it,
such as my ($para 1, $para 2 ...) =@_, when a function call is filled with several parameters, it is possible to take several parameters
One: SystemThe system function is the simplest way to start a Perl subroutine. Eg:system "Date"1: Can use Shell function to start background processSystem "Run_cmd with Parameters &"; #在后台执行2:system performs a normal return value of 0, otherwise the
Multi-process: With multiple PID, the memory is occupied independently.Multi-threaded: does not have a separate PID.Select: Multiple processes can be selected without the output of the shared variables, etc., when a partial independent generation of
1. Intelligent matching operatorAlternative binding operators:Find a key in the hash: The comparison of two arrays is exactly the same: Find out if an element exists in the list: The smart match operator is independent of order. ~ ~ Around
Regular Expressions in Perl
1. It is a wildcard and can match any single character, except for line breaks. If you want to use. In the mode, use /.
2. * match the first item zero or multiple times, such as/AB * C/match AC, ABC, abbbbbc...
3. +
The test script is as follows:
My $ run_app_path = "C: // exit_value.pl ";My $ ret_val = system ($ run_app_path );Print "system value is: $ ret_val/N ";$ Ret_val = $ ret_val> 8;Print "return value is: $ ret_val/N ";Exit 0;
The
1. Search for the required modules from www.cpan.org and download them. the download is generally in GZ or tgz format.
2. Extract and Compress With WinRAR and other software
3. In comman mode, enter the decompressed folder and the directory
Sometimes we need to process some attributes of the file, such as read-only and hidden,
Here I will explain how to obtain and modify the attributes of a file in Win32.
Required: Use Win32: file;
Use the following method:
My $ set;
#
1. A given expression has different meanings in different contexts2. In the scalar context, Nums returns the number of its elements. In the list context, its elements are returned.3. Print @ Nums; each element is not separated by spaces unless print
1. Write the code and # Run the CHMOD 755 file name directly.2. debugging is also possible, # Perl-M file name3. Transfer characters only play a role in double quotation mark strings, and scalar variable interpolation is also the same4. Use a scalar
Application of Regular Expressions
1. // is short for M //./http: // is not easy to read. You can write m {http: //} or M % http: // %
2. The forward slash is not a metacharacter. If it is not a separator, you do not need to use a backslash before
1. $ where = index ($ big, $ small); the character position starts from 0. if the substring is found at the beginning of the string, index returns 0. if a character is followed, 1 is returned, and so on. if the substring does not exist,-1 is
1. Die "Oops! A file named '$ filename' already existed! "
If-e $ filename
Use the-E Option to check whether the file exists before the system creates a file.
2. Warn "config file is looking pretty old! /N"If-M config> 28; # config is a file
9.1 search scalarSearch by indexIndex string, substringIndex string, substring, start_positionThe index function starts running from the left side of the string and searches for substring.
To the position of the substring. 0 indicates the leftmost
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.