use strict; use warnings; my $text = '.'x400; my $summary = substr($text, 0, 500); print length(unpack 'H*', $summary) / 2, "\n"; #### 400