I have a question. See a code:
use 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);
at the end, @ip is an array of ip. But, for load @ip I have used a loop while because I used
%record = $sth->fetchhas
Is there a faster method?
Thank you.