CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Append two lines to a file through perl!!

 



UnixAAP
Novice

Mar 28, 2014, 3:05 AM

Post #1 of 2 (1437 views)
Append two lines to a file through perl!! Can't Post

HI Guys,

I have created a dummy script to append two lines in an existing file.
But my issue is I want a line break between
Forward messages to server by IP
&
.*.\@1.2.3.4

That means the two lines should be added to '' fileone" one after the other ..

Dunno how to add it .... Please help!!

my $fileone = "/etc/fileone";
my $fileadd = "#Forward messages to server by IP" & ".*.\@1.2.3.4";
$ssh->system("echo $fileadd >> $fileone");


Laurent_R
Veteran / Moderator

Mar 28, 2014, 11:01 AM

Post #2 of 2 (1422 views)
Re: [UnixAAP] Append two lines to a file through perl!! [In reply to] Can't Post

Change your two lines to:


Code
my $fileone = "/etc/fileone\n"; 
my $fileadd = "#Forward messages to server by IP" & ".*.\@1.2.3.4\n";


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives