- 论坛徽章:
- 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 无
复制代码
- 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 ;
- }
复制代码
1.执行这个函数后,在MySQL数据库中4&63bA2fqp%^变成4&63bA2fqp\%^
2.而如果\Q$pw\E'不加\Q.......\E的话uYu337i\r@06就会变成
哪位大大帮帮忙了。谢谢! |
|