Thanks to the people who promptly replied.

I have two quick follow-up questions:

1) What does "s/\s*$/\./" do? (see email below)
2) What are the differences between:

$string .= '.' unless $string =~ /[$!.]+$/; (suggested in another email)

and

$title =~ s/\s*$/\./ unless $title =~ /[!?.]\s*$/;


Chris

-----Original Message-----
From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 02, 2005 2:54 PM
To: beginners@perl.org
Subject: Re: Checking last character of string for punctuation

Chris Schults [CS], on Wednesday, February 2, 2005 at 14:39 (-0800)
wrote the following:

CS> However, some of my titles and subtitles end with punctuation ("?", "!",
CS> ".", "..."). Thus, I end up with: Am I a title that ends with
punctuation?.
CS> Do-oh!.

my $title = 'This is just test  ';
$title =~ s/\s*$/\./ unless $title =~ /[!?.]\s*$/;
print $title;

enjoy:)

-- 

 ...m8s, cu l8r, Brano.

[Confucius Says: Those who quote me are fools.]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to