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: Intermediate:
New Lines are not printing after certain messages

 



tbest4475
New User

Mar 31, 2008, 2:50 PM

Post #1 of 2 (255 views)
New Lines are not printing after certain messages Can't Post

I have a program that is run on numerous AIX servers, that will collect information and then compare it to the previous day’s info. It will then email a list of any differences.



I am running into an issue where a new line will not always print after certain statements.



It appears to be an issue with certain variables that are presented in these print statements.



The strange thing is if I take the program through debug and view the array it shows that each statement is on a new line. The log prints correctly, but the email does not. Outlook 2003



Code:

$message = "A difference in /opt/local/bin has been noted: $opt_local_bin{$file}{'new'}{'file'} is now available\n";

push @messages, $message;



then I will present them in a single variable and email them:



$message = join('',@messages);

$subject = "CM Audit Daily Changes Notification";

&mail_admin($subject,$message);



The result I get from this is, where the red comment is the next difference the program finds:



A difference in /opt/local/bin has been noted: clean_oratab is no longer available A change in /etc/hosts has been detected. 10.40.250.3 r2dmn1 # regatta 2 domain 1 switch is no longer available



If I join with a new line ($message = join('\n',@messages);) I get:



A difference in /opt/local/bin has been noted: clean_oratab is no longer available



A change in /etc/hosts has been detected. 10.40.250.3 r2dmn1 # regatta 2 domain 1 switch is no longer available



But I do not want the whitespace between the lines.



If I use ‘’ between the variable and end of the line it works, bit it prints the ‘’:



$message = "A difference in /opt/local/bin has been noted: $opt_local_bin{$file}{'new'}{'file'} is now available\n";

push @messages, $message;



gives the following result:



A difference in /opt/local/bin has been noted: ‘clean_oratab is no longer available’

A change in /etc/hosts has been detected. 10.40.250.3 r2dmn1 # regatta 2 domain 1 switch is no longer available



Obviously it is something in the variable output on certain lines. But again it only affects the emailed results, not anything I can see in debug or the log files which is an exact copy of what is sent to the email program.



Any ideas before I give up?


KevinR
Veteran


Mar 31, 2008, 5:27 PM

Post #2 of 2 (253 views)
Re: [tbest4475] New Lines are not printing after certain messages [In reply to] Can't Post

I posted a suggestion to this question on another forum, I don't remember which forum it was though.
-------------------------------------------------

 
 


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

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