There are a couple things you should read first, in the official DBI documentation:
An example session of me focusing on the SQL statements that were run:
rm -f /var/tmp/sql.log
# the next line appends, not overwrites
DBI_TRACE='1=/var/tmp/sql.log' perl script.pl
grep "FETCH('Statement')\|prepare_cached\|bind_param" /var/tmp/sql.log | less
More verbose:
DBI_TRACE='2=/var/tmp/sql.log' perl script.pl
grep -i 'prepare for .*\| execute for .*\|Binding parameters.*\|parse_params .*\|dbd_st_execute returning.*row_num.*\|fetchrow_array= .*\|dbd_st_fetch.*currow.*' /var/tmp/sql.log | less
Even more verbose, which includes the data returned in the result set:
DBI_TRACE='SQL|4=/var/tmp/sql.log' perl script.pl
grep 'FETCH= \[' /var/tmp/sql.log | less