in reply to Null fields

You can check to see whether a value is defined or not using the oddly-named defined function; DBI fetch will, as busunsl says, return the special undef value.

if (!defined($foo) ) { print "$foo is undefined.\n"; }

A suggestion: you have a whole bunch of variables named "one", "two" etc ... consider storing them in an array instead and an array slice to build that SQL statement up.

HTH

Philosophy can be made out of anything. Or less -- Jerry A. Fodor