if(condition1){ @words = split(/=/, $_); print "$_"; $sth->execute($words[0],$words[1]) or die $DBI::errstr; } if(condition2){ @words = split(/=/, $_); print "$_"; $sth->execute($words[0],$words[1]) or die $DBI::errstr;}