Hi Sandip,
On Wed, 8 Aug 2012 15:47:24 +0530
Sandip Karale <[email protected]> wrote:
> Hello ,
>
> I'm new to perl.
>
> I am on windows 7 64 bit machine. with Strawberry Perl (64-bit)
> 5.14.2.1.
It's good that you are using Strawberry Perl.
>
> *My Code:*
>
> use File::Spec::Functions;
> my $f="foo.txt";
> my $d="\\\\\\\\mach\\\\dir";
Why do you have four backslashes here and then two? (Note that they are
escaped, so
it's twice as that)? In Perl, a backslash is a backslash, even when it
is interpolated. So you can just do something like:
my $BS = "\\";
my $d = "$BS${BS}mach${BS}dir";
That may be the source of part of your problem.
Regards,
Shlomi Fish
>
> print "$f \n";
> print "$d \n";
> print catfile($d,$f);
>
>
> *Output:*
> *
> *
> foo.txt
> \\\\mach\\dir
> \mach\dir\foo.txt
>
> *My Problem:*
> *
> *
> After concatenating with UNC path and file, the concatenated path is
> wrong! the expected path is \\mach\dir\foo.txt
> Please help me out if I'm missing something.
>
> Sincerely,
> Sandip
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity
Larry Wall *does* know all of Perl. However, he pretends to be wrong
or misinformed, so people will underestimate him.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/