Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, I am facing a problem where FTP'ing a file ending with newline characters is creating an issue,please look at the file below am FTPing and notice the "\n" characters,these "\n"characters are messing up my procedure.how should I remove the "\n" characters while FTP'ng.Please advise
open(FILE, ">micro\\config") || die "Wrong Filename"; print FILE ("micro=/mnt/micro/config/\n"); print FILE ("config=/mnt/system/config/\n"); print FILE ("dump=/mnt/dump/\n"); config file gets created as follows micro=/mnt/micro/config/ config=/mnt/system/config/ dump=/mnt/dump/ FTP'ing using the below code:- $ftp = Net::FTP->new("10.69.11.65", Debug => 0) or die "Cannot connect to the target: $@"; $ftp->login("user","user") or die "Cannot login ", $ftp->message; $ftp->binary(); $ftp->cwd("/mnt/micro/config") or die "Cannot change working directory ", $ftp->message; $ftp->put("micro/config", "config") or die "put failed ", $ftp->message; $ftp->quit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: New line problem
by davido (Cardinal) on Apr 25, 2011 at 19:40 UTC | |
|
Re: New line problem
by mikeraz (Friar) on Apr 25, 2011 at 19:52 UTC | |
|
Re: New line problem
by bart (Canon) on Apr 26, 2011 at 11:38 UTC |