1) is the URL Legal:/^ (http: \/| https :\/\/)? ((? : [A-Za-z0-9] +-[A-Za-z0-9] + | [A-Za-z0-9] +) \.) + ([A-Za-z0-9] + )[\/\? \:]?. * $/
2) When to escape: 1. For example, if you want to use "in" ", then \"; 2. Some special characters
3) database garbled: You must set the same encoding for the tables queried in the script and the inserted tables, such as utf8 ($ db_url-> do (set names utf8 )), set UTF-8 when securecrt display, set names utf8 before querying database display;
4) log generation problem: If the log file does not have the write permission, the log information will be output to the standard output. Securecrt sz/Rz may also encounter directory permission problems
5) do not perform full re-dumping of inverted data. You can set the time start point or even the table auto-increment ID to read and write data from the file. When the tmmp table is empty, Perl SQL returns true by executing the following statement, determine whether the idmax value is "" mysql> select max (ID) idmax from tmmp; + ------- + | idmax | + ------- + | null | + ------- +
6) Pay attention to the Perl type. For example, if $ URL is a string, $ url = 0 may be true.
7) perl Print $ log "XXX"; syswrite $ log, "XXXX"; many characters of printf in Perl may be printed incorrectly. It is best to use syswrite to print data.
8)> or> If the file does not exist, it will be created, just the difference between truncate or append
9) SQL Execution error. Many garbled characters are displayed on the page, including characters that cannot be displayed in log files. This is often because the inserted parameters contain garbled characters, which leads to the execution error of some quotation marks in advance, one solution is to take only some length fields of the parameter.
10) When the log file is too large, it is often displayed as new file when Vim is opened. You can use tail/head-N num file | more to view part of the content.
11) $ db-> quote ($ URL). In this way, you do not need to add ''to $ URL when inserting SQL statements. If $ URL contains single quotation marks, it will be escaped; SQL Execution errors may be caused by quotation marks being closed in advance.
12) mysql> pager less multi-page display
13) Select substring_index ('xxx. XXX. xx.22 ','. ',-1) // get 22
14) the hashed values in Perl are reference copies instead of value copies.
15) chomp results must be obtained before Perl prints the results of shell scripts. Otherwise, the printed information is incorrect.
16) obtain the URL suffix, such as HTML, PHP, And if ($ url = ~ /^ (Http: \/| https: \/). * \/. * \. ([^ \/\. \?] +)/) {My $ suffix = $2 ;}
17) retrieve the domain name my @ TMP = Split (/: //, $ URL) from the URL; my @ tmp2 = Split (//, $ TMP [1]); my $ domain = $ tmp2 [2];
Perl accumulation (occasionally updated)