How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ?
Like in Shell script, we use tee, is there anything in Perl or any other option ?
How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ?
Like in Shell script, we use tee, is there anything in Perl or any other option ?
Have you checked CPAN? Else you can program it in Perl, simply for opening another file for appending and writing to this file in addition to printing to the screen
Yes...found a way.
open (STDOUT, "| tee -ai log.txt");
print "blah blah";
close (STDOUT);
This works perfectly. Thanks ghostdog74