Or alternatively:
substr $string, 0, 5, ''; [download]
In reply to Re^2: text file parsing with chomp by jwkrahn in thread text file parsing with chomp by fjdb3