The Perl CGI environment variables differ depending on the server. So this content does not necessarily correspond to your Web server completely.
The following items are sorted alphabetically:
1. Auth_type
If the server supports Basic
Q: I now have an HTML page code that wants to change it to a Perl program if simply add "#!.. in its first line /perl/bin/perl ", and change the file suffix name to. CGI, the error prompts" you don t have permission to access/test/index.cgi on the
Can be done using find with sed or perl.
To find the current directory,
The code is as follows
Copy Code
Replace into
The code is as follows
Copy Code
Find./-type f-exec sed-i "S//
Write some monitoring scripts in Perl and put them in crontab to schedule execution. It is sometimes found that a script runs too long and runs multiple instances at the same time, so it is necessary to control the script and run only one instance.
Method one (not using modules, by Agonyr)
Copy Code code 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 {"
Creating characters with code points
$alef = Chr (0x05d0);$alpha = Chr (Hex (' 03b1 '));$omega = Chr (0X03C9);
You can convert a string to a code point by using the Ord () function:$code _point = Ord ('? ');
Comparing numeric stringsEqual = =
1, fault phenomenon650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/9D/2E/wKiom1l6_IeRSXWSAADzCy_Fxnw500.png "title=" depth _ Select Area _20170728165132.png "alt=" Wkiom1l6_iersxwsaadzcy_fxnw500.png "/>Error reason: The system does not
PI is calculated mainly by Monte Carlo method. The code is as follows:1) pi.pl: $time 1 = Time (), foreach (1..20000000) { my ($x, $y) = (rand (), Rand ()); if (sqrt ($x * * 2 + $y * * 2) The Perl script runs as follows, and the average
Using a hash as a reference is deprecated at the template Example/index.html.ep line 8Using a array as a reference is deprecated at the template Example/index.html.ep line 8It's simple because the hash and array are not used correctly.%=% $entries->{
A short Perl program allows for large functions.How does Perl do that?1. Default variablesIf no parameter value is supplied to the function, the default parameter is $_;If no variable is used to receive the value of an expression, the default
When debugging a Perl program, it is very convenient and effective to use the Smart::comment module to track the variable values of the code.code example:1 # !/usr/bin/perl 2 3 Use Smart::Comments; 4 # no smart::comments;5 my $var=@ARGV[0]; 6 7 # #
Alex Suykov had do some work for this purpose, and my compile script was based on her patch.Stepsstep 1:Download Perl source code from Perl ' s official site, such as:
wget http://www.cpan.org/src/5.0/perl-5.20.2.tar.gz
Step 2:Download
The first time I installed VM tools in Fedora, I encountered this problem, and now I would like to share my solution with you, hoping to help you! problem: After extracting the compressed package from VM tools, I execute it under
Types and usages of Perl variablesvariable types and their uses| type | sigil | example | is a name for | | ------------+-------+-----------+----------------------------------------|| Scalar | $ | $cents
The here documentation mechanism for Perl is derived from the here document mechanism in the UNIX shell.As in the shell, the here document in Perl is also a row-oriented reference form, requiring a After If the terminating string is not enclosed in
Variables defined in Perl are global by default.1) My function: limits the name and value of a variable to a certain range. That is to say, the variable can only be a module or function at the current layer.You can see that this variable is
I. File Location relocation function:
1. Rename () function: rename a file
$ Ret = Rename (oldname, newname );
This function is used to rename the old file name oldname to a new name newname, or transfer the file oldname to the specified directory
Time conversion is inevitable when you use Perl for script development. The following example shows how to convert the system time to the Standard Time:
#! /Usr/bin/perlUse strict;Use dBi;
$ | = 1;
My $ username = "root ";My $ Password = "123456
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