. . . my $ST = $DB->prepare("insert into my_table(foo, bar, baz) values (?, ?, ?)"); . . . code to prepare CSV file . . . # For each record, read it while (my $fields = read_data_from_csv_file()) { # Ignore records we don't want next if $fields->{BLECCH} = 'REJECT'; . . . other stuff . . . # Stuff our record into the database $ST->execute( $fields->{FOO}, $fields->{BAR}, $fields->{BAZ} ); }