Hi All,
I am trying to print a log file created in the same script with the code bellow.
but Im not getting output on screen.
The output file is created using rediretion of output.
please help me regarding this.
Regards
Naveen.
I am trying to print a log file created in the same script with the code bellow.
but Im not getting output on screen.
The output file is created using rediretion of output.
Code:
open(STDOUT, ">flat.log") || die "Can't redirect stdout";
prinf " ----------------------------------------------\n";
printf " xyz ";
prinf " ----------------------------------------------\n";
close STDOUT;
open(STDOUT, '>/dev/tty') or die "Can't restore stdout: $!";
my $count;
$count = 0;
my @data;
my $line;
open(FILE, "< flat.log") or die "can't open file: $!";
$count++ while <FILE>;
@data = <FILE>;
close (FILE);
#open(STDOUT, '>/dev/tty') or die "Can't restore stdout: $!";
if ( $count > 45 ) {
print " See the log file for details. \n";
}else {
print "@data";
}
Regards
Naveen.
Comment