Several problems encountered in this process:First, run the Perl script directly in the command line. Everything is normal. You can also run the checkin and checkout commands in the version management software.The source code is automatically
[Example 1]
#! /Usr/bin/perlUse strict;
@ _ = (A, B, C, D );
Print "@ _ \ n ";
The output is a B c d.
[Example 2]
Print @ _. "\ n"; # or print @_."";
Number of output @ _: 4
[Example 3]
Print @_;
Display output: ABCD (without spaces)
How to Use the Perl script to operate system environment variables?
Clever friends will immediately think of the special hash variable $ ENV provided in Perl. Right, some system variables can be obtained in $ ENV. How can this problem be obtained?
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
$ Refers to one, @ refers to a bunch, and % refers to hash --------------------------------------------------- X string repetition operator. eg: "Fred" x 3 = "fredfred" ------------------------------------------------------ Array: $ # Index
Redirects standard output and error output to the corresponding log file for any function.
Record the function running time for any function.
Code:
#
! /Usr/bin/perl
Use Warnings;
Use Strict;
No Strict
"
Refs
" ;
Sub
1. Open and Close files
The syntax is open (filevar, filename), where filevar is the file handle, or is
Program Is used to represent the code of a file. filename is the file name, and its path can be relative or absolute.
Open (file1, "file1
1. delimiters
= ~ M/there /;
= ~ S/there/here /;
There are also types of delimiters:
= ~ /There/
= ~ M # there #;
= ~ S # there # here #;
= ~ M (there );
= ~ S (there) (here );
= ~ M {there };
= ~ S {there} {here };
= ~ M [there];
= ~ S [there]
Chapter 2: subprocesses/functions
Declaration: subfunction_name;
Definition: subfunction_name {...}
Function call is the same as C:
Example_subroutine (); or example_subroutine;
Example_subroutine ('perl is ', 'my favorite', $
This is a slides made by libreoffice. It is used to introduce colleagues to some basic knowledge about Perl programming. This knowledge is included in several typical camel books, but the purpose, focus, and direction of reading are different for
Whether you understand the concept of the Perl method in the Perl language. Here we will give you a brief introduction. The Perl method of the Perl class is just a Perl subprogram, also known as a member function.
Perl Method
1. Perl Method
The following is a DNA sequence stored in F: \ perl \ data.txt under the window:
Copy codeThe Code is as follows: aaaaaaaaaaaaaagggggttttcccccccc
CCCCCGTCGTAGTAAAGTATGCAGTAGCVG
Ccccccccggggggggaaaaaaaaaaaaattttttat
AAACG
The following is a
1. What is Perl Hash?
A hash is a data structure. Similar to an array, a hash can store a value or retrieve the value from it. However, unlike an array, its index is not a number but a name. That is to say, the index (here we call it key) is not a
A Conversion Program simply converts A in the DNA sequence to T. In the first case, private variables are not used.
Copy codeThe Code is as follows :#! /Bin/perl
# Below is a DNA sequence
$ DNA = ATTATATAT; # Here is our sequence
$ Result = A_to_T ($
1. do:
1) form:Do 'filename ';Note:Here, single quotes must be added to filename; otherwise, an error will occur;Filename can be any suffix or even has no suffix. Do not ask for pl or pm.
2) do:Do 'filename'First, you must read the filename file.
Delete an object
Use unlinke functions, such as unlink $ file, unlink $ file1, $ file2, $ file3
Open a file
Open the file with three parameters, which makes it easy to differentiate the mode and file name. This method is supported in Versions later
Perl uses the functions rand () and srand () to generate random numbers (more specifically, pseudo-random numbers. These functions do not use encryption to provide security, so do not use them to encrypt your financial information. However, if you
Perl was first designed by Larry Wall), which was published in December 18, 1987. Perl uses the features of C, sed, awk, shell scripting, and many other programming languages. The most important feature is that it integrates the Regular Expression
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