#!/usr/bin/perl -w use DBI; use Net::Telnet (); $t = new Net::Telnet (Timeout => 10,); $user = "admin"; $passwd = ""; $t->open("Sparta"); $t->login($user, $passwd); @lines = $t->cmd("switchshow"); my $dbh = DBI->connect( ... ); my $sth = $dbh->prepare( q{INSERT INTO table (field_a, field_b) VALUES (?, ?)}); foreach my $line ( @lines ) { #$sth->execute(1, $dbh->quote($line) ); $sth->execute( 1, $line ) } $dbh->commit; $dbh->disconnect;