spadacciniweb has asked for the wisdom of the Perl Monks concerning the following question:
I have a question. See a code:
Thank you.
at the end, @ip is an array of ip. But, for load @ip I have used a loop while because I useduse strict; use warnings; use Mysql; my @ip; my %record; #### Connect to db my $dbh = Mysql->connect( $mysql_host, $mysql_db, $mysql_user, $mys +ql_pwd); #### Create query my $query = "select ip from mal_switch"; #### query to database my $sth = $dbh->query($query); while (%record = $sth->fetchhash) { push @ip, $record{'ip'}; } print(@ip);
Is there a faster method?%record = $sth->fetchhas
Thank you.
Back to
Seekers of Perl Wisdom