use DBI; my $user = 'username'; my $password = 'password'; my $database = 'mydb'; my $host = 'localhost'; my @entries = (); my $dbh = DBI->connect("DBI:mysql:$database:$host",$username,$password) or die $DBI::errstr; my $sth = $dbh->prepare("SELECT * FROM table;"); $sth->execute(); while(my @array = $sth->fetchrow_array){ if($array[0] =~ /SUCHTEIL/){ $array[0] =~ s~SUCHTEIL~ERSETZUNGSTEIL~OPTIONEN; push(@entries,\@array); } } $sth->finish(); foreach(@entries){ $dbh->do("UPDATE table SET spalte1 = '$array[0]', spalte2 = '$array[1]'... WHERE ID = id;"); } $dbh->disconnect();