You can always use '/' as the directory delimiter, even in Windows. Perl
on Win32 translates / properly.
Gerardo Carvallo Velasco wrote:
Hello to everyone;
I am a beginner in Perl and I have the next problem:
I should copy a file from winXP (local) to a Linux server.
When I select the file to be copied from a form it appear with the
this format: c:\path\file
in my script I try to change the "\" for "/" using the following
instruction:
sub uploadFile{
$file = $data{'our_file'};
$file =s/\\/\//g;
$target = "C:/myfiles/documents/drcarvallo/TargetFile.txt";
unlink $target if(-e $target);
open(FILE,"<$file");
open(FILE1, ">>$TargetFile") || &show_error("$filepath: Can't open
because ($!).");
while (<FILE>){
$line = $_;
chomp($line);
flock(FILE1,2) if $UseFlock;
print FILE1 "$line\n";
flock(FILE1,8) if $UseFlock;
}
close(FILE1);
close(FILE);
return 1;
}
When conclude the script, copy to selected path a file without data.
However, if I change the slashes ("\" to "/") the file is made correc.
Could somebody indicate me how make it correctly?
Thank an regards.
Gerardo Carvallo
------------------------------------------------------------------------
Nuevo MSN Messenger Una forma rĂ¡pida y divertida de enviar mensajes
<http://g.msn.com/8HMBESCL/2740??PS=47575>
------------------------------------------------------------------------
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs