If you want to get the 1st 5 characters of a string, use
substr:
my $string = substr($data[0], 0, 5);
If this does not answer your question, please:
- Enclose your code in 'code' tags (see Writeup Formatting Tips).
- Show a small sample of input data.
- Show a small sample of output data.