On 4/21/09 Tue Apr 21, 2009 11:16 AM, "Grant" <emailgr...@gmail.com> 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: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/