my ($file) = $url =~ m~[^/]*$~; You didn't test this did you? You need to capture: my ($file) = $url =~ m~([^/]*)$~; tachyon