http://www.perlmonks.org?node_id=845410


in reply to substr question

Something like this, where a "word" is defined by surrounding whitespace (\s):
use strict; use warnings; my $s = "Hello, I am a perl/mysql programmer, but am self taught so I +do not know all the awesome features Perl has, however, I am ok at it + though, I guess."; my $s2; for (split /\s+/, $s) { $s2 .= "$_ "; last if length($s2) > 100; } print $s2; __END__ Hello, I am a perl/mysql programmer, but am self taught so I do not kn +ow all the awesome features Perl