in reply to Html list sorting problem
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Html list sorting problem
by shahbazq (Initiate) on Sep 30, 2001 at 00:42 UTC | |
by tachyon (Chancellor) on Sep 30, 2001 at 03:04 UTC | |
by shahbazq (Initiate) on Oct 02, 2001 at 18:57 UTC | |
|
Re: Re: Html list sorting problem
by shahbazq (Initiate) on Sep 30, 2001 at 00:20 UTC |