Linux perl--sending mail and monitoring memory

#!perluse warnings;use strict;use net::smtp_auth;#&sendmail;while (1) {My ($sumMem, $freeMem, $rateMem); open MEM, " Cat/proc/meminfo | "or Die $!; while () {$sumMem = $ if (/memtotal:\s+ (\d+) \s+kb/), $freeMem + = if (/memfree:\s+ (\d+) \s+kb/);

Perl:perl is used in conjunction with regular expressions, loops, and shell commands.

There is an instance where Perl reads a pattern from the configuration file, which has a combination of shell commands to get current information about Linux, and the entire pattern is complete after getting the return value of the shell

Perl, Python, Erlang, C language running speed comparison

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

Perl---window under mojolicious frame hints using a hash as a reference is deprecated at template

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->{

Perl Learning Notes

1) Perl is very flexible, and some people say that the worst thing about reading Perl code is that a judgment condition can be placed behind a statement, for example:My $value = "value" if $needvalue;Sometimes, if the preceding statement is long and

Perl Learning Four: statements

Statement:If/unlessWhile/foreach/do. While/for1. Summary of true value of expressionAny expression has a true or false value: logical, String, list, file2.ifif (expression1) {statements;}else if (expression2) {statements;}Else{statements;}3.unless

Perl formatting templates

#!/usr/bin/env perluse warnings;use strict;use getopt::long;use findbin qw ($Bin); use File::basename QW (Basename); File::spec::functions QW (rel2abs); ##### Main Program # # # # #my $mainPL = basename ($); my $ysbin = "$Bin/ysbin";&main; Exit;sub

Module installation in Perl

Psl:perlstandard Library, which focuses on the built-in functions of PerlPerl modules have built-in modules and third-party modules.Perldoc perlocal View built-in modulesPerldoc module-name View Module Help informationPerldoc-m module-name View

Perl Variables and usage

Types and usages of Perl variablesvariable types and their uses| type       |  sigil | example   | is a name for                            | | ------------+-------+-----------+----------------------------------------||  Scalar     | $     |  $cents

Perl: Modules and Packages

Perl Modules and Packages:Keywords related to modules:Use Module-name: Adding modulesUse Module-name qw/functionname/; #导入具体的函数Use Module-name qw//; #不导入具体函数, you need to call the function with a full pathUse Module-name {};

Perl:split function Usage

In this paper, we focus on the use of the Perl split function, a very useful function in Perl is the Perl split function-splitting the string and putting the segmented result into the array. This Perl split function uses the regular expression (RE)

Perl installation Mojolicious

c:\users\admin>ppm install mojoliciousdownloading mojolicious-6.08...donedownloading IO-Socket-IP-0.37 ... Doneunpacking mojolicious-6.08...doneunpacking io-socket-ip-0.37...donegenerating HTML for Mojolicious-6.08 ... Donegenerating HTML for

How to debug in Perl?

If It is a small program, you can use the this to:c:\rebecca\script\perl>perl-d calculate.plLoading DB routines from perl5db.pl version 1.39_10Editor support available.Enter h or ' h ' for help, or ' Perldoc perldebug ' for morehelp.Main::(Calculate.

Perl Study Notes (v)--input and output

File handleThe file handle (filehandle) is the name of the application that represents the I/O connection between the Perl process and the outside world. is not the name of the file.Open File HandleDefault file handles provided by Perl: STDIN,

Learning Perl Learning Notes

1. File read-write and command-line parameters#!/usr/bin/perlUse strict;if (@ARGV Die "Usage:perl $ inputfile outfile\n";}My ($infile) = @ARGV [0];My ($outfile) = @ARGV [1];Open My $infile _fh, "," $infile "| | Die ("Can ' t Open the file!");Open My

Reconstruction of the data access layer (and reconstruction of Perl applications)

When I went to school, I heard the saying "most of the code written by a student in the first few years of programming after graduation is spam", and I did not care about it. I have been working for more than a year now, and I feel more and more

Analysis on the INC settings of 5-perl in the Age of small

1) The default Inc is as follows: @ INC: C:/perl/site/lib C:/perl/lib2). Set the environment variable perl5lib to add it to Inc. For example: set perl5lib = C: perllibs after perl5lib is set, % env: perl5lib = "C: perllibs" @ INC: C: perllibs

Regular Expression in Perl

I used the Perl language a few days ago and mainly looked at regular expressions in Perl. In various web languages, regular expressions are very useful when processing strings, so here we will briefly talk about the application of regular

Perl's camel spirit (2)

In Perl, you can create a subprogram (subroutine) by yourself ): Keyword sub, subprogram name, and code block enclosed by curly brackets. Sub marine {...} The subprogram name is different from the scalar namespace.   Return Value of a subroutine:

Guide practice of Perl

#!/usr/bin/perluse strict;use warnings;#This is a practice of perl, as which shows with below perl code...codes.print "Hello, world!\n";my $animal = "camel\n";my $answer = 42;printf $animal;print "The animal is $animal\n";print "The square of

Total Pages: 66 1 .... 55 56 57 58 59 .... 66 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.