s/\s+$//;
I don't know how familiar you are with regexs so don't get offended if I overexplain. :)
s/// is the substitute operator. It will take the pattern on the left hand side and replace the first match with what's on the right. There is a lot more that can be done with this with optional flags, etc.
the \s is a character class that represents any whitespace character. (Not everyone agrees on what is whitespace!)
the + tells it to match one or more of the previous characters.
And the $ says that it should be anchored at the end of the string (the line in $_ in this case).
Because there is nothing on the right hand side of the substitute, the space at the end of the string that matches this gets replaced with nothing.
Basically this says "match one or more whitespace characters at the end of the string and replace it with nothing."
As far as info on programming in Perl, the O'Reilly books are a must have, several of which are written by merlyn himself, if you are going to buy them, help him out by getting them here.
If money is tight, go for the Perl CD Bookshelf which has a CD-ROM version of most of the ones you want. IMHO, they are a must have for any Perl programmer and are indispensable.
Don't forgot www.perl.com, under documentation there are several tutorials of interest.
And of course, don't forget to power search the Monastary!
Good luck. | [reply] |