^ -> Beginning o the string
$ -> End of the string 

$myVar =~ s/^\s+//; -> Remove all Leading White Space
$myVar =~ s/\s+$//; -> Remove all Trailing White Space

What is your actual requirement ??


-----Original Message-----
From: Alaric Joseph Hammell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: chop off 1 white space?



At 01:34 PM 6/11/02 -0700, I wrote:
>At 04:26 PM 6/11/02 -0400, Alaric Joseph Hammell wrote:
>
>>How would I get rid of one trailing white space character in
>>$HASH{$key} and reassign the result
>
>If you're certain that the last character is a space:
>
>         chop $HASH{$key};
>
>If it might not be a space, and you only want to get rid of the last 
>character if it is a space:
>
>         $HASH{$key} =~ s/ $//;

>Oops, I missed the "white" part of "white space".  Then the question >is 
>whether you intend "white space" to include newline.  Assuming you >don't 

>(which is Perl's definition of "white space"), then:
>
>         $HASH{$key} =~ s/\s$//;

Ok, What I meant by "match" was "compare" or test for equality. Sorry for
the confusion.

But, could someone explain the meaning of the "$" in the above expression,
s/\s$// .  

How would I incorporate in the expression the $string which occurs before
the white space? (is that what the "$" is for?)

Thank you for all the helpful responses,
Al



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to