in reply to Re^2: Problem Modifying Files
in thread Problem Modifying Files

You are using \\ in interpolation context, and then again:

$new = "c:\\temp\\mytest"; # c:\temp\mytest -- ok so far open NEW, ">$new"; # c:<tab>emp<return>ytest -- oops

Try it using non-interpolating, single quotes. For example:

$new = 'c:\\temp\\mytest';

Replies are listed 'Best First'.
Re^4: Problem Modifying Files
by mikeatrcn (Acolyte) on Sep 22, 2004 at 19:40 UTC
    Hi fglock:

    I'd agree if I were using single backslashes, but the double ones translate to a single backslash in the path. See the snippet below.

    Both ways yield the same results.

    Thanks for your help!

    #!/usr/bin/perl -w use strict; use File::Copy; my $new='c:\\temp\\mytest'; printf ("new = $new"); open NEW, ">$new" or die "I can not open file to write: $!\n"; print NEW "this is a test"; close NEW; << this yields the following on the CMD screen: >> new = c:\temp\mytest C:\Program Files\OptiPerl\webroot\cgi-bin>