my $maxlen = 20; # could be 255 if you like my $memo = "This is a really long string and I only need to show the first $maxlen characters..."; print substr( $memo, 0, $maxlen ), "\n";