in reply to Re^2: New Lines are not printing after certain messages
in thread New Lines are not printing after certain messages
"$cmd"
needless creates a copy of $cmd. Just use
$cmd
local?!
local($sub,$msg) = @_;
should be
my($sub,$msg) = @_;
What's with launching another process to read a file?
@cur_admin_lines = `cat $curAdmins`;
should be
my @cur_admin_lines = do { open(my $fh, '<', $curAdmins) or die("Unable to read list of admins ($curAdmins): $!\n"); <$fh> };
echo? print!
my $cmd = "echo \"$msg\" | mail ..."; system("$cmd");
should be
my $cmd = "mail ..."; open(my $fh, '|-', $cmd) or ...; print $fh $msg; close($fh);
And it's already been pointed out that $msg and $sub aren't properly converted from string to shell argument literals. Using MIME::Lite would avoid that problem.
|
|---|