Hi Shlomi,

Thanks for your reply.

my $d="\\\\\\\\mach\\\\dir";  This UNC path I'm getting from arguments, and
then I want to process it. That is I want to concatenate the file name to
it and open the file and print its contents. So your solution will not help.

Sincerely,
Sandip


On Wed, Aug 8, 2012 at 4:13 PM, Shlomi Fish <shlo...@shlomifish.org> wrote:

> Hi Sandip,
>
> On Wed, 8 Aug 2012 15:47:24 +0530
> Sandip Karale <sandipkar...@gmail.com> 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 .
>

Reply via email to