make_treewalker()
and walk_tree()
as a template, create an infinite list of integers, such that:
for (my $l = make_infinite_list(0); ; $l = $l->[1]->()) { print $l->[0] . ", "; }Will print '0, 1, 2, 3, 4, ...' off to infinity. Can you improve on the interface?
perl_to_html()
. However, this function has at least one bug: HTML elements such as code
, img
, and meta
cannot be closed with </tag>
. Fix this.perl_to_html()
: write a function html_to_perl()
that consumes a string that is valid HTML and returns our Perl representation of the HTML. Feed the output of html_to_perl()
into perl_to_html()
and see how the string input and output match.<p class="messy">Foo <strong>bar</strong><p>
, we get in Perl [ "p", { class => "messy" }, "Foo ", [ "strong", "bar" ] ]
.This was copied to the new site.