in reply to formatting output from a mysql query in column format

You could use printf for this.

... printf "Label-1:\t%s\n", $ary[0] ; printf "Label-2:\t%s\n", $ary[1] ; ...

I should also mention your post is confusing. You would get better help from us by describing what you are trying to do, including a sample of your data, and then separately describing the problem you are encountering.