Sometimes I just can't help myself. Here is a little bit of code to get you started. It will get all the text of all the <li> items into an array and then sort that array alphabetically.
#!/usr/bin/perl -w use strict; use HTML::TokeParser; my @list; my $file = "c:/test.htm"; my $p = HTML::TokeParser->new($file) || die "Can't open $file: $!"; while ( my $token = $p->get_tag( qw(li) ) ) { my $text = $p->get_trimmed_text(); push @list, $text; } @list = sort @list; print "Item $_: $list[$_]\n" for 0.. $#list;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Html list sorting problem
by tachyon
in thread Html list sorting problem
by shahbazq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |