in reply to Perl DBI to MySQL LOAD_FILE

Quick thing I noticed:

'$code';

Single quotes don't interpolate a variable into its value. Try:

"$code";

...or depending on the real code:

$code;