There are many ways to read the last line of a file in Perl, such as(1) Read the file into the array and take the last elementOpen (FILE, "file.txt") or Die "$!"; My @arr =;; Close File;my $last = $arr [$ #arr];# $last is the last line of content.(2)
Use the linux backdoor loader program written in perl-general Linux technology-Linux programming and kernel information. The following is a detailed description. Print "++ linux Backdoor tool ++ \ n ";
Print "usage instructions, there are three
Article Title: how to run cgi written in Perl in Apache environment. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open-source and other basic
Reprint: http://blog.sina.com.cn/s/blog_4a0824490101hncz.html(1)/C means to replace the characters that are not matched.$temp = "Aaaabcdef";$count = $temp =~tr/a/h/c;Print "$temp \t$count\n";Results: Aaaahhhhh 5(2)/d: Replace all characters on the
/** * Use under perl: * #华氏温度和摄氏温度之间的转换功能更加完善print "Please enter the temperature to be converted, for example: 20c/30f\n"; $input = ; #获取输入的内容chomp ($input); #去掉文本结尾的换行if ($input =~ m/^ ([-+]?[ 0-9]+ (\.[ 0-9]*)?) * ([CFCF]) $/) {# m/^ ([-+]?[ 0-9
\ W matches a letter, number, or underline, it is equivalent to [a-zA-Z_0-9] \ s matching an empty character \ D matching a number \ B matching the beginning and end of a word ^, $ is the unit of action to lock the location, while \ B locks the
How to debug in Perl ?, Debugperl
If it is a small program, you can use this way:
C: \ Rebecca \ script \ perl>Perl-d calculate. pl
Loading DB routines from perl5db. pl version 1.39 _ 10
Editor support available.
Enter h or 'H H' for help, or '
A easy example to tell you what is "2> & 1" in Perl, easyexample
You can decide if make the output shown on command screen by using 2> & 1 or NUL
Testing script:
Print "without null \ n ";
System ("dir2> & 1");
Print "with null \ n ";
System ("dir>
Implicit inheritance in Perl
Implicit inheritance
Today, I saw a disconnection. Code : A. PM Code: [copy to clipboard] Package; ... Sub test {Print "test \ n ";} B. PM Code: [copy to clipboard] Package B;Use; B-> test (); I think it is
Use of exit functions in Perl
O exit exprO exit
This function calculates the expr value as an integer and uses this value as the finalProgramError statusExit. If expr is omitted, the function exits as 0 (meaning "no error ").
At the same time,
The following two commands can be used to check insecure syntax in Perl programming: #! /Usr/bin/perl-W Or: Use warnings; Although both of them can prompt insecure syntax, there is still a difference. The Perl help documentation writes:
()GroupExample: ($ fruit, $ color) =/(. *)/SIS/s (.*)/;Values in each bracket are returned values in the list.
= ~This operator does not assign values. It just extracts the operator on the right and enables it to operate on the variables on the
#!/usr/bin/eperl-w# filename:crc-16.pl## Copyright Axxeo GmbH# Licensed under the Apache License, Version 2.0 (the "License");# You are not a use of this file except in compliance with the License.# Obtain a copy of the License at##
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.
program annotations in Perl: Single-line and multiline comments(i) Single-line Comment:Lines beginning with # are considered by Perl as annotations. But with one exception, the first line of the Perl program begins with a #, and he specifies the
In Perl, Srand () provides random number seeds for use by rand (), and Rand () produces random number generators.If Srand () is not invoked before the first call to Rand (), then the system automatically invokes Srand () for you.Calling Srand ()
As with most other programming languages, Single-line comments in Perl also begin with a #, such as:
Copy Code code as follows:
#print "hello,world!";
But multiline annotations, different languages have different ways of
Chomp and chop are all characters used to remove the tail of a string variable, but they have their own differences.
The Chomp function works on a variable, and this variable contains a string. If there is a newline character at the end of the
Summarize some of the uses of list and array operations in Perl
Suppose you define an array variable @arr and assign the list (str_a, Str_b, Str_c, str_d) to the array @arr
@arr = (str_a, Str_b, Str_c, str_d);
Assign the number of elements in an
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.