• Method of connecting SQL Server database with Perl under windows and Linux system


    This article will provide some examples of Perl connecting to Microsoft SQL server databases. Perl scripts run on windows and Linux platforms. Windows platform If you run Perl script on Windows platform, it is recommended to use two module packages that rely on DBI to provide standard database interface modules. DBD::ODBC DBD::ADO Using DBD:: ODBC […]

  • Perl script realizes the function of detecting host heartbeat signal


    Using serial port communication, the following script is used at the standby terminal to detect the heartbeat signal from the host. Once the number of unaccepted times exceeds the specified count, the standby considers the host down and automatically sets it as the network parameter of the host to provide services instead of the host. […]

  • Use file:: lockfile in Perl to ensure that the script runs in a single instance


    Some monitoring scripts are written in Perl, and are executed in crontab. Sometimes it is found that a script runs too long and multiple instances run at the same time. Therefore, it is necessary to add control to the script and run only one instance. The simplest and natural idea is to check and create […]

  • 7 Perl array advanced operation skills sharing


    1. Remove duplicate elements from an array: Code snippet using grep function:code: Copy codeThe code is as follows: my @array = ( ‘a’, ‘b’, ‘c’, ‘a’, ‘d’, 1, 2, 5, 1, 5 ); my %count; my @uniq_times = grep { ++$count{ $_ } < 2; } @array;   Use to convert hash snippets:code: Copy codeThe […]

  • What is Perl? Detailed introduction to programming language Perl


    Perl was originally designed by Larry wall and was published on December 18, 1987. Perl borrows features from C, SED, awk, Shell Scripting, and many other programming languages. Larry wall is on the newsgroup comp sources. Misc released Perl scripting language version 1.0, when he was a programmer at Unisys. Perl draws lessons from the […]

  • Perl object-oriented instance


    First, let’s look at three basic definitions of Perl object-oriented programming: 1. An “object” refers to a simple reference that “has a way to know which class it belongs to”. (an object is a reference variable)2. A “class” refers to a simple package that “has a way to provide some methods to its objects”. (class […]

  • Perl Eval function usage instance


    As a scripting language, Perl can generate and execute code in real time. This feature can delay the compilation of code until runtime, so it is also called “dynamic code”. In addition, Perl also provides exception handling mechanism like Java and C + +. This article will discuss the function of dynamic code and exception […]

  • Perl function (subroutine) learning notes


    1、 Function definition A subroutine is a separate piece of code that reduces duplication of code and makes the program easy to read In Perl, subroutines can appear anywhere in the program But it is usually placed at the beginning or end of the program   Copy codeThe code is as follows: sub subroutine{     […]

  • Control structure learning notes in Perl


    1、 Types of statements A computer is a tool that has the advantage of performing repetitive tasks Loop execution, loop statement.A lot of judgment needs to be made, and conditional statements are executed according to conditions.Sequential statements.Summary of true and false values of expressionsThe expression is not necessarily a logical expression, but the true and […]

  • Perl implements the deletion of thumbnails in the picture cache under windows db


    When I took over the project that others had done before, I found that the ignore in SVN was not correct * DB processing, resulting inpictureAll the cached thumbnail files have been submitted, and as long as I open the picture folder, it means thumbs DB has changed.   There are two things to do: […]

  • Introduction to cpan module of 10 operation dates and times in Perl


    Ability to manipulate dates and times for mostprograming languageIt is a basic ability, and Perl is no exception. But when it comes to more complex processing related to time, Perl’s own functions often seem inadequate. In this case, it’s a good idea to go to the Perl comprehensive collection network (cpan). There are many Perl […]

  • Introduction to string operation functions chomp and chop in Perl


    Chomp and chop are characters used to remove the tail of string variables, but they have their own differences. The chomp function works on a variable that contains a string. If there is a newline at the end of the string, chomp can remove it. This is basically all the functions it can perform, as […]