- 論壇徽章:
- 0
|
D:/perl/2.txt:
- x.x.x.x uYu337i\r@06 22 aa aa 無
- x.x.x.x IM;MZ26py`9D 22 aa aa 無
- x.x.x.x 4&63bA2fqp%^ 22 aa aa 無
- x.x.x.x 7=RLf3yBti=& 22 aa aa 無
- x.x.x.x K=^72sLX8v.J 22 aa aa 無
- x.x.x.x Qxh41P^=h4"= 22 aa aa 無
- x.x.x.x ?ba8D14jm?2f 22 aa aa 無
復(fù)制代碼
- sub insert(){
- open FILE,"D:/perl/2.txt" ;
- while (<FILE>) {
- my ($ip,$pw,$port,$location,$business,$remark) = split ;
- print ;
- my $insert= "insert into ip_info (ip,pw,port,location,business,remark)
- values ('$ip','\Q$pw\E','$port','$location','$business','$remark')";
- $s = $dbh->prepare($insert);
- $s->execute();
- }
- $s->finish();
- $dbh->do("commit");
- close FILE ;
- }
復(fù)制代碼
1.執(zhí)行這個函數(shù)后,在MySQL數(shù)據(jù)庫中4&63bA2fqp%^變成4&63bA2fqp\%^
2.而如果\Q$pw\E'不加\Q.......\E的話uYu337i\r@06就會變成
哪位大大幫幫忙了。謝謝! |
|