http://www.perlmonks.org?node_id=1013385


in reply to Extracting only required length in a column in perl DBI

If you only need the first three characters of each column, why not simply ask for that when doing your query? For example:

SELECT SUBSTR(COL1, 0, 3) FROM TABLENAME;

Consider using place holders where possible, See DBI and Bobby Tables.