Help for this page
@dirs = split qr{[\\/]}, $path; $file = pop @dirs unless -d $path;
$path = '/' . join '/', @dirs, ($file // '');