> -Original Message-
> From: Sophia Corwell [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 2:56 PM
> To: [EMAIL PROTECTED]
> Subject: Deleting leading/trailing whitespace
>
>
> Is there a way to delete leading/trailing whitespace
> in one fly?
>
> I have the following:
>
On Wed, Aug 08, 2001 at 02:24:39PM -0500, Mooney Christophe-CMOONEY1 wrote:
> > From: Sudarsan Raghavan [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 08, 2001 1:48 PM
> > To: Sophia Corwell
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Deleting leading/trailing
> From: Sudarsan Raghavan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 1:48 PM
> To: Sophia Corwell
> Cc: [EMAIL PROTECTED]
> Subject: Re: Deleting leading/trailing whitespace
>
>
> ($temp) = $temp =~ m/^\s+(\S*)\s+$/;
No, because this won'
On Wed, Aug 08, 2001 at 11:55:42AM -0700, Sophia Corwell wrote:
> $temp =~ s/^\s+//; # Removing leading spaces
> $temp =~ s/\s+$//; # Removing trailing spaces
>
> Is there a way to combine these two statements into one?
There is, as has been mentioned by John Way. However, unless you have some
($temp) = $temp =~ m/^\s+(\S*)\s+$/;
regards,
Sudarsan
Sophia Corwell wrote:
> Is there a way to delete leading/trailing whitespace
> in one fly?
>
> I have the following:
>
> $temp =~ s/^\s+//; # Removing leading spaces
> $temp =~ s/\s+$//; # Removing trailing spaces
>
> Is there a way to com
try this...
$string = " text ";
print "Before regex:\"$string\"";
$string =~ s/^\s+|\s+$//g;
print "After regex:\"$string\"";
(the "|" indicates an OR)
John Way
Confidentiality Notice: ***
Privileged/Confidential information may be contained