in reply to My array element won't print outside a loop

You need to append to your array element instead of assigning to it anew in every loop iteration e.g
while($parser->get_tag){ ## Note the . before = and the use of . instead of , $stripped_html[0] .= $parser->get_trimmed_text() . "\n"; } print $stripped_html[0];
See. perlop for more info on the .= operator.