joemidnite has asked for the wisdom of the Perl Monks concerning the following question:

We are switching from one server to another for our PERL Scripts, and so far everything is working, but I am having problems with on program which works on the old server but not the new one. The problem I have is creating a file in a directory on another server. I use "\\\\gailbapps\\cybraryn\\TDmenu\\A-Cyb_Stats\\" as my path to the serever, and to create it, I use open (TOT_TXT, '>{servername and filename}'). But when I try to write print TOT_TXT "Hello\n";, it does not work. Can anyone help? I print out the path and put it in Windows Explorer and it goes right there, so I do not know why it cannot be accessed. The code is below:
$relative_addy = "\\\\gailbapps\\cybraryn\\TDmenu\\A-Cyb_Stats\\"; $month_year = $date_month . "_" . $date_year . ".txt"; $tot_file = $relative_addy . $month_year; open (TOT_TXT, '>$tot_file') || die "$tot_file open failed: $!"; print "File: $tot_file<p>"; print TOT_TXT "Hello\n"; close(TOT_TXT);
I am not sure if this is a PERL problem, but if I am not doing a correct pat, I would like to know.
Joseph A Ruffino IT Technician

Replies are listed 'Best First'.
Re: Path to another server
by toolic (Bishop) on Jul 01, 2010 at 01:33 UTC
    open (TOT_TXT, '>$tot_file') || die "$tot_file open failed: $!";
    The single quotes prevent interpolation of the $tot_file variable. This opens a file whose name is literally $tot_file, instead of the contents of the variable. Try this:
    open (TOT_TXT, '>', $tot_file) || die "$tot_file open failed: $!";