|Pathologically Eclectic Rubbish Lister|
substr questionby Anonymous Monk
|on Jun 18, 2010 at 16:10 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I want to only show the first 100 characters or so of a string that has more than 100, but I don't want to split it in the middle of a word, so is there a way to do it instead of this:
I have searched but not sure how to do it.
For instance if this was the string:
"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."
If that was the string that that code would get this: "Hello, I am a perl/mysql programmer, but am self taught so I do not know all the awesome features Pe" it would cut off the word Perl, so is there a way to do it where it does it somewhere around there that is not in the middle of a word?