tbest4475 has asked for the wisdom of the Perl Monks concerning the following question:
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. Code:
then I will present them in a single variable and email them:$message = "A difference in /opt/local/bin has been noted: $opt_local_ +bin{$file}{'new'}{'file'} is now available\n"; push @messages, $message;
The result I get from this is, where *NEWLINE* is the next difference the program finds:$message = join('',@messages); $subject = "CM Audit Daily Changes Notification"; &mail_admin($subject,$message);
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, but it prints the ‘’:
gives the following result:$message = "A difference in /opt/local/bin has been noted: ‘$opt_local +_bin{$file}{'new'}{'file'} is now available’\n"; push @messages, $message;
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: New Lines are not printing after certain messages
by mhearse (Chaplain) on Mar 31, 2008 at 21:13 UTC | |
|
Re: New Lines are not printing after certain messages
by pc88mxer (Vicar) on Mar 31, 2008 at 19:30 UTC | |
by tbest4475 (Initiate) on Mar 31, 2008 at 19:44 UTC | |
by ikegami (Patriarch) on Mar 31, 2008 at 21:57 UTC | |
by wojtyk (Friar) on Mar 31, 2008 at 20:27 UTC | |
|
Re: New Lines are not printing after certain messages
by holli (Abbot) on Apr 01, 2008 at 03:15 UTC |