in reply to matching white spaces in perl

Could you simply match against "<result>" and ignore the whitespace?
Or, trim the leading spaces to make them the same?

Or, you could check out http://perldoc.perl.org/perlreref.html, in particular, the "?" entry under syntax.