The following is a cut/paste of your code with the addition of use strict;use warnings;, the addition of variable declaration, removing your LOG line and substituting "echo" for "/home/admin/bin/email.ksh".
use strict; use warnings; my $LOGFILE = 'junk.txt'; open my $FH, "<$LOGFILE" or die "Failed to open $LOGFILE"; my @contents = (); while (my $LINE = <$FH>) { push @contents, $LINE; } close $FH; my @args = ("echo", "@contents", "Web Server Issue", "PROD", "/home/ad +min/logs/check_jvm/EmailAlert.log"); system(@args) == 0 or die "system @args failed: $?"
It echos The contents of the file. Web Server Issue PROD /home/admin/logs/check_jvm/EmailAlert.log as expected. Are you sure you are invoking your shell script properly? Can you invoke it successfully from the command line? If it comes down to debugging a shell script or perl, I'd be inclined to suggest putting time in on hbm's suggestion.
In reply to Re^3: Passing the contents of a file in a "system" call to a .ksh script
by kennethk
in thread Passing the contents of a file in a "system" call to a .ksh script
by BrotherElwood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |