in reply to dir / file split
$file_path =~ /(.*)\/([^/]*)/; my ($dir, $file) = ($1, $2); [download]
It should satisfy all reasonable paranoia.