Take the 2-minute tour ×

I'm looping through an array that has stored some values from HTML::TreeBuilder, where a look_down() was used. When I print $value, I get the below, which I would like dereferenced.


Doing a print \$value seems to return a generic reference:


What is the symbol/s I need to dereference a HTML::Element hash reference?

Note: Using $$value returns error Not a SCALAR reference

EDIT: Solution found thanks to cjm via comments. I needed print $value->as_HTML

share|improve this question
If its a reference then try using $$value. Better post the code so that i can look over it for better help. –  Raghuram Feb 17 '12 at 3:32
What output are you expecting to get? Are you looking for $value->as_HTML? –  cjm Feb 17 '12 at 3:37
@cjm - Thanks that was what I was after!!! –  kurotsuki Feb 17 '12 at 3:56
add comment

1 Answer

up vote 3 down vote accepted

When you have an object (indicated by the "HTML::Element" part of HTML::Element=HASH(0xe687f4)), you should normally access it only through its documented interface. For HTML::Element, important methods include as_HTML (which returns the element and its content as a string of HTML code) and dump (which prints a summary of the contents and is useful for debugging).

So, if you want to print the HTML you've extracted, use:

print $value->as_HTML;
share|improve this answer
add comment

Your Answer


