in reply to Re^2: Can't get a simple log creator to work!
in thread Can't get a simple log creator to work!
thanks but it's not putting what i enter into terminal into that file.
Yes it does.
>perl a.pl fasfd dsfdasfdasf dsafsdafdas fdasfdasfs ^Z >type perlogfile.rtf fasfd dsfdasfdasf dsafsdafdas fdasfdasfs
Perhaps you are peeking at the file before you stop adding to it, in which case you are suffering from buffering. Fix:
#!/usr/bin/perl use 5.010; use strict; use warnings; use IO::Handle qw( ); my $fn_log = 'perlogfile.rtf'; open(my $fh_log, '>>', $fn_log) or die("Can't append to log file \"$fn_log\": $!\n"); $fh_log->autoflush(1); print($fh_log $_) while <STDIN>;
|
|---|