in reply to Re^2: odd text object problem - how to store as string?
in thread odd text object problem - how to store as string?

Sorry to be dense, but what is $obj in your example?

When I read

my $test = DumpTable(...

I got confused and thought that was the Text::ASCIITable constructor. Of course, that's not the case, so what I said doesn't apply.


Please avoid

my ... for ...;

It straddles edge cases in Perl. my ... if ...; is not allowed, for example, and it's not clear what your code does.

May I recommend

my $table = ( $t->find_by_tag_name('table') )[-1]; return DumpTable($table);

If the find only returns one table, you can also use

my ($table) = $t->find_by_tag_name('table'); return DumpTable($table);

Replies are listed 'Best First'.
Re^4: odd text object problem - how to store as string?
by emmiesix (Novice) on Jun 25, 2011 at 00:15 UTC

    Thanks, that makes sense now. Sorry for the bad form with the ellipses... I will be less lazy next time.

    I will need to learn more perl before I can understand some of these ways of writing constructors, destructors, etc. But your solution worked and I think I understand what's going on. Thank you!!