On 4/21/09 Tue Apr 21, 2009 11:16 AM, "Grant" <[email protected]>
scribbled:
>>> $string =~ s/\s//g;
>>
>> The above line deletes all of the spaces in $string. Is that what you want
>> to do?
>
> All fixed up except for this. How can I remove only the spaces at the
> end of $var1 and $var2 if they exist?
Anchor your substitution regular expression to the end of the string:
$var1 =~ s/\s+$//;
This will delete any whitespace characters at the end of $var1.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/