Transferred from your original blog on yourblog, written on 13:05:48
After reading jackey's "bugzilla installation in Windows", the installation is successful according to the method described in this article. However, jackey does not seem to be
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
In Perl, srand () provides the random number seed for rand (). Rand () generates the random number generator.If srand () is not called before rand () is called for the first time, the system automatically calls srand () for you ().Calling srand ()
How to Use Perl scripts to operate system environment variables?
Presumably many of my 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
1. Time Function: returns the number of seconds that have elapsed since January 1, January 1, 1970.Use: My $ t = time ();
2. localtime function: Get the local time zoneUse: My $ T = localtime (Time ());
3. gmtime function: Get Greenwich Mean
Have you ever encountered a phenomenon where too many directory files cannot be deleted on UNIX? I wrote a Perl
ProgramDelete
CopyCodeThe Code is as follows: CAT> Del. pl
#! /Usr/bin/perl
$ File1 = $ argv [0];
@ Tests = (1, 2, 3, 4, 5, 6, 7, 8
Original article link
Linux Perl shell Perl VI grep awk xargs batch replacement
Method 1:
Maven is used to build an application in the past two days. Due to the large project, there are more than 700 pom S. XML file, even more depressing
Basically, a simple variable is a data unit, which can be a number or string.I. Integer1. IntegerThe most common simple variables in Perl are not described here because they are basically the same as other languages.Example:$ X = 12345;If (1217 + 116
Suppose there is a sequence like this:1 21 22 11 31 41 54 1We need to get the following results:1 31 52 14 1Therefore, use the following perl script to implement it.
Code 1:
Copy codeThe Code is as follows :#! /Bin/perl
Use strict;
Use warnings;
My $
Copy codeThe Code is as follows :#! /Usr/bin/perl
My % scyjm;
Open (CONTACT, "f: \ perl \ f.txt") | die ("can not open the file! ");
While ()
{
Next if/^ #/; # if ($ _ = ~ /^ #/
Chomp;
My @ information = split; # my @ information = split/\ s +
Method 1 (do not use modules, by agonyr)
Copy codeThe Code is as follows :#! /Usr/bin/perl-w
Use strict;
My @ seq = ("A", "T", "C", "G ");'My $ length = 10000;
Undef my % hash;$ Hash {"A"} = int ($ length * 0.3 );$ Hash {"C"} = int ($ length * 0.3
The pop operation extracts the last element of the array and returns the result:
@ Array = 5 .. 9;$ Fred = pop (@ array); # $ fred gets 9, @ array is (,) now)$ Barney = pop @ array; # $ barneygets8, @ array is (5, 6, 7)Pop @ array; # @ array: (5, 6)
A routines call in CGI. pm
1. CGI. pm implements two usage methods: Object-oriented method and traditional perlmodule method.Object-Oriented Approach:
Copy codeThe Code is as follows :#! /Usr/local/bin/perl-w
Use CGI; # load CGI routines
$ Q = CGI->
Open a file using the Open () function
Common methods to open a file are:
Copy codeThe Code is as follows: open (FH, "Or die "Couldn't open $ filename for reading: $! ";
The open () function usually has two parameters. The first is the file handle,
1. Read all the content in the file into an array at a time (this method is suitable for small files ):
Copy codeThe Code is as follows: open (FILE, "filename") | die "can not open the file: $! ";
@ Filelist = ;
Foreach $ eachline (@
1. Single Line (large file processing ):
Copy codeThe Code is as follows: my $ oneline = or
While ($ line = )
{}
2. Read all (small File Processing ):
Copy codeThe Code is as follows: open (my $ in, "path") or die "open error: $! ";
My @ lines = ;
Read files:
Copy codeThe Code is as follows :#! Perl
Open filetxt, "/path/a.txt"; # filetxtis the file handle and is used to establish a link with file a.txt. The file handle can be named at will, but it should not be the same as several file
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