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

$query =~ s/,$//;

Better, though, to not put it there:

my @cols = qw(foo bar baz); $query1 = 'select ' . join (',',@cols);
join is your friend :-)