in reply to File operations
Are you sure there is anything in $content? One way to check would be to use the debugger.
Update: as a general thing, simultaneous read and write access to a file gets messy. Also, not sure, but your use of DATA as the file handle might be causing trouble as well; it's a special word.
use strict; use warnings; open my $fh,'>>','logname' or die "Could not open logname"; while (1) { my $content = $rh->cmd(...); if (defined $content) { print $fh $content } else { print 'Nothing to be done!' } sleep 1; } close $fh;
|
|---|