palsy017 has asked for the wisdom of the Perl Monks concerning the following question:
Here is the code:
use URI::Escape; my $start = "http://www.xxxx.com/programs_results/"; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->get( $start ); my @links = $mech->find_all_links( url_regex => qr/\d+.+\.pdf$/ ); chdir $progdest or die "Can't change directory: $!\n"; for my $link ( @links ) { my $url = $link->url_abs; my $filename = URI::Escape::uri_escape( $link- >url_abs->path ); $filename =~ s[^.+/][]; mech->get( $url, ':content_file' => $filename ); }
This code(listed above) works, but I need to make a change. The PDFs are saving with the encoding in the file name. How could this be filtered so that the end result looks like A, not B?
A. 100004_20090326.pdf
B. %2Fpdf%2F100004%2F_20090326.pdf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about URI::Escape
by ikegami (Patriarch) on Mar 30, 2009 at 19:23 UTC | |
|
Re: Question about URI::Escape
by Anonymous Monk on Mar 31, 2009 at 06:32 UTC |