#!/usr/bin/perl use 5.010; use warnings; use strict; use DBI; my $table = 'null_value_table'; open my $fh, '>', $table or die $!; while ( my $row = ) { print $fh $row; } close $fh or die $!; my $dbh = DBI->connect( "DBI:CSV:" ); my $sth; say "\nselect all\n"; $sth = $dbh->prepare( "SELECT * FROM $table" ); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { say "@row"; } say "\n\n\nselect where col1 = Y\n"; $sth = $dbh->prepare( "SELECT * FROM $table WHERE col1 = 'Y'" ); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { say "@row"; } say "\n\n\nselect where col1 <> Y\n"; $sth = $dbh->prepare( "SELECT * FROM $table WHERE col1 <> 'Y'" ); $sth->execute(); while ( my @row = $sth->fetchrow_array ) { say "@row"; } $dbh->disconnect; __DATA__ col0,col1 1,Y 2,N 3,NULL 4,undef 5,0 6,'' 7,