use Tk; use DBI; use Data::Dumper; $mw = new MainWindow; my $host='127.0.0.1'; my $user = 'joe'; my $passwd = ''; my $db = 'test_bank'; foreach (qw/Vorname/) { $mw->Label(-text => $_)->pack(); $mw->Entry(-textvariable => \$results{$_})->pack(); } $mw->Button(-text => "Ok", -command => sub { print Dumper %results; print $results{Vorname}; $dbh = DBI->connect("DBI:mysql:database=$db;host=$host", $user, $passwd, {'RaiseError' => 1}) or die 'Fehler beim Verbinden!'; $sth = $dbh->prepare(qq[INSERT INTO inhalt ( `id` , `name` ) VALUES ('', '$results{Vorname}')]); $sth->execute; } )->pack(); $mw->Button(-text => "Exit", -command => sub { exit } )->pack(); MainLoop();