I'm improving an old script that I had that downloaded some wallpapers for me. I need to know how many
pages of wallpapers one category have. Each link has the number of the page as its text, ie:
<a href="/planes-desktop-wallpapers/page/8">8</a> <a href="/planes-desktop-wallpapers/page/9">9</a> <a href="/planes-desktop-wallpapers/page/10">10</a>
So I need to capture the number ten, because then I can know for sure how many pages that category has.
I've been trying something like:
#!/usr/bin/perl -w use strict; use warnings; use WWW::Mechanize; use HTML::TreeBuilder; use List::Util qw(max); ... my $site = "http://www.hdwallpapers.in /planes-desktop- wallpapers.html"; $mech->get($site); my @links = map {$_->text} grep {$_->text =~ m/\d+/} $mech->find_all_links(); print max @links;
Problem is I'm also getting some junk in the array (not only numbers), so I get a compile error.
Can someone please shed some enlightenment here? tnx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |