$path = File::Spec->catfile( @directories, $filename ); #### use Modern::Perl qw/2017/; use File::Spec; my $directory_name = 'testdir'; my $path = File::Spec->catfile( qw/C: Users darkblack Desktop A/, $directory_name ); say $path;