Subject: Checking last character of string for punctuation Howdy all. I'm a newbie with a newbie question. I assume that I'm in the right place.
I need to update some code a developer programmed for my organization. The purpose of the code is really basic. It simply prints: $title. $subtitle. However, some of my titles and subtitles end with punctuation ("?", "!", ".", "..."). Thus, I end up with: Am I a title that ends with punctuation?. Do-oh!. So, I need to revise the code so that it first checks each string to see if it ends with a punctuation character. If it does, don't add the period. If not, do add the period. Note: the string should be kept as is. I believe the key is a regular expression of some sort, but I can't seem to figure it out. Any help would be appreciated! Thanks in advance, Chris $string .= '.' unless $string =~ /[$!.]+$/; See if this helps... jwm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>