my $url = ' http://www.perlmonks.com/foo?bar=baz'; print "Downloading >$url<\n"; # note use of delimiters to make a stray # leading space more visible in your debug my $ff = File::Fetch->new(uri => $url); say "scheme: " . $ff->scheme; say "host: " . $ff->host; say "path: " . $ff->path; say "file: " . $ff->file; say "output_file: " . $ff->output_file; #### ## outputs: Use of uninitialized value in concatenation (.) or string at ./foo.pl line 10. scheme: # <- error host: http: # <- error path: //www.perlmonks.com/ # <- error file: foo?bar=baz output_file: foo #### #!/usr/bin/env perl -w use strict; my $url = 'http://www.ekey.net/downloads-475?download=2132cbe2-2fb1-eeff-583c-50a39b6aba6c&name=v2_ITA_12-Seiter_Programm_1207_web.pdf'; (my $output_name = $url) =~ s/^.*name=(.*)$/$1/; print "$output_name\n"; __END__ #### ## outputs: v2_ITA_12-Seiter_Programm_1207_web.pdf ####