in reply to text file parsing with chomp

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: