in reply to help substituting whitespaces?
I will toss out the obiligitory comment about CPAN is your friend. Especially the HTML:: family of modules. It can be very very tricky to deal with HTML via a regex for much beyond extremly simple (?:X|HT|DHT)ML etc... You could alleviate alot of your parsing headaches, and get down to the meat of what you want to do, all with a simple use statement.
With that said, if you are doing this simply as an excercise in data munging have fun! :) perldoc perlvar is the place to go for all documentation about variables, or at least a nice springboard. If you are ever lost about what perldoc to read, try perldoc perltoc or even perldoc perl.