in reply to Re^2: Passing the contents of a file in a "system" call to a .ksh script
in thread Passing the contents of a file in a "system" call to a .ksh script

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.

Replies are listed 'Best First'.
Re^4: Passing the contents of a file in a "system" call to a .ksh script
by BrotherElwood (Initiate) on Jan 08, 2009 at 20:51 UTC
    Kennethk, I have what you listed, but I pre-declared some of the variables at the start of the code. Something I am just used to. I may look into emailing within the script with a second email config file, just trying to stay away from doing so for obvious reasons. Thanks!
      A few months ago, I wrote a secret santa script that involved automated e-mailing to a list contained in an external file. You may find it useful: Re: Temporarily Obscuring a Lottery Draw. Happy hunting.
Re^4: Passing the contents of a file in a "system" call to a .ksh script
by BrotherElwood (Initiate) on Jan 08, 2009 at 21:31 UTC
    Kennethk, I have what you listed, but I pre-declared some of the variables at the start of the code. Something I am just used to. I may look into emailing within the script with a second email config file, just trying to stay away from doing so for obvious reasons. Thanks!