in reply to Perl with XML

Not that you care, but your code won't run correctly under use strict. One way to fix this is to use my to create a lexical scope for the variable $portresults :
my $portresults = parsePortfolioResponse($sampleXML);
If you fix this, you might be able to run the program and answer the teacher's questions yourself.

buckaduck