in reply to How to take the last character out of a string

perldoc -f chop

perldoc -f substr

Alternatively you could build the string better to begin with. For instance:

@stuff=qw(foo bar baz); $query = "select " . join (',', @stuff) . $rest_of_query;

(just an example, caveat lector)