in reply to Display shortened paragraph

I think you want "substr" (see "perldoc -f substr"):
my $maxlen = 20; # could be 255 if you like my $memo = "This is a really long string and I only need to show the f +irst $maxlen characters..."; print substr( $memo, 0, $maxlen ), "\n";

Replies are listed 'Best First'.
Re^2: Display shortened paragraph
by blazar (Canon) on Feb 01, 2006 at 11:57 UTC
    Indeed his request sounds quite strange, since breaking at 255 charachters may be suboptimal for some text to be shown. However it's not entirely clear to me if he wants to read in a file by chunks of fixed lenght. If so, then curiously I wrote a note just a few minutes ago about how to use $/ to do so. E.g.:
    $/=\255;