my @links = $mech->find_all_links(url_regex => qr/\.pdf/i); my @urls = map { $_->url_abs } @links; foreach (my $foo @urls ) { my $abs_path = "C:/path"; $mech->set_download_directory( $abs_path ); $mech->get($foo); } #### my $filename = "C:/path/filename"; my $foo = "http link"; $mech->get($foo, ':content_file'=>$filename); #### my $response = $mech->get($url); my $c = $mech->content; # Dummy request to initialize everything open my $output, '>:raw', '/tmp/output.jpg'; print { $output } $response->decoded_content;