In this article we learned how to sort strings or arrays of numbers in Perl.
Perl has a built-in function called sort. There is no doubt that you can sort an array. The simplest form is to pass an array that returns an array of sorted elements.
In this article we learned how to sort strings or arrays of numbers in Perl.
Perl has a built-in function called sort. There is no doubt that you can sort an array. The simplest form is to pass an array that returns an array of sorted elements.
If there is such a sequence:1 21 22 11 31 41 54 1We need to get the following results:1 31 52 14 1Then, use the following Perl script to implement it.Code One:
Copy Code code as follows:
#!/bin/perl
Use strict;
Use warnings;
my
Sort by Requirement:
Copy Code code as follows:
#!/bin/perl
@number =QW/5 10 15 3 2 4 8 6/;My @descending =sort {$a $b} @number; #这里 $a = 10, because $a was previously, the result of Perl was decimal in the previous, or ascending order.
Special symbols for Perl
@ Array$x {} x preceded by a dollar sign ($) followed by a curly brace ({}), it is a hash element% to reference the entire hash, using the percent sign (") as the prefix. The hash used in the previous pages is
In the text processing often encounter this situation: there are a number of files need to modify the contents, but also want to retain the contents of the original file. This time Perl provides a handy variable $^i, after you save the suffix for
Perl is often used for system configuration and management automation on open platforms, but it can also be applied flexibly on host systems. This article describes the three Perl modules associated with z/Os on CPAN, Net::ftp, Mvs::jesftp, and Net::
The Perl programming language has a history of more than 26 years.
December 18, 1987 Larry Wall introduced the Perl programming language, and the first post to quote the language was in 88 January, from Google's discussion group: Perl, a
The length of the Perl array and the number of elements $ #数组名---represents the subscript of the last element in the array, which equals the number of elements minus 1. The @ array name---Represents the number of elements in the array. $ scalar
Requirements : Some of the RESTful APIs have been implemented to remove the value of some key from the return value of the RESTful API by invoking the RESTful API.1) in rest, each object is a 1 URL;Here you need to know how Perl sends the request
I. Password Verification:1. Install the Net: SSH: Perl module. For the installation method, see install the Perl module.2. In the example of automatic logon, log on to the server 192.168.0.100 using the testuser and run the DF command:
#! /Usr/bin/
Perl object-oriented first let's take a look at the three basic definitions of Perl Object-Oriented Programming: 1. an "object" refers to a simple reference that "there is a way to know which class it belongs. (An object is a reference variable) 2.
I. Hash Variables
A hash variable is also called an associated array. Like an ordinary array, you can use a subscript to access the data elements. The difference is that the subscript of a hash variable can not only be a non-negative integer, it can
Here I'll summarize three ways to open a temporary file using Perl.
The first wayIs to create the new object via module IO: file to get a read/write file handle as below.
My $ temp_fh = IO: file-> new_tmpfile;
Perl closes these files when the scalar
Writing intention:The built-in netstat in Linux system often finds that CPU consumption is high when capturing information, especially when some monitoring systems are used,It is found that if netstat is used, the monitoring system itself will cause
This article only implements compilation, and calling WCF is not successful yet (the server digital certificate is called without authentication !)
1: Install ActivePerl (latest ActivePerl-5.12.2.1203)
Http://www.activestate.com/activeperl/downloads/
= Head1 name
The name of your program or module.
= Head1 synopsis
A one-line description of what your program or module does (purportedly ).
= Head1 description
The bulk of your documentation. (bulk is good in this context .)
= Head1
When creating an array in perl, you can use qw.
However, if you want to create an array consisting of 20 people, and the name of each person is in this form of "Join smith" "Harry Potter", that is, each name contains both a surname and a name. In
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