I am working on a script where I am suppose to run some command and if it fails generate the log file and this is what I have done,
system($command);
if ($? == -1 )
{
$step = $step -1;
display_err($command,$step);
exit;
}
sub display_err
{
my ($cmd,$step)= @_;
open(LOG, ">>release_log.log")|| die "Unable to open release_log.log f
+or output: $!\n";
print LOG <<HEADING;
==================================================================
HEADING
print LOG "[Command Execution Failed]\n";
print LOG "Command: $cmd\n";
print LOG "Command Succeful upto: $step\n";
print LOG scalar localtime();
close LOG;
}
Any body have any suggestion how can I make it more Perlish?Please,