Perl DBI函数
use DBmodule; $db_s=new DBmodule; $db_key=$db_s->connect_db('w3a_system','localhost','root','ferbernet!@#!@!'); $abk=$db_s->select_db($db_key,"select * from w3a_xser"); %log_result=result($abk,'<scriptaa>'); if(%log_result){ print "匹配"; for }else{ print "不匹配"; } sub result{ local($sql)=shift; local($method)=shift; # clean list array # print execute result my %target=(); while($list=$sql->fetchrow_hashref()){ # $regex=$list->{'method_regex'}; if($method=~m/$list->{'method_regex'}/) { $target{'id'}=$list->{'id'}; $target{'method_name'}=$list->{'method_name'}; $target{'method_level'}=$list->{'method_level'}; $target{'method_switch'}=$list->{'method_switch'}; } } return %target; }