use IO::Handle; #for flush method my $rtlamr = "/home/jj/go/bin/rtlamr -msgtype=scm+ --format=json -filterid=1 +01419821,101419999 -unique=false"; open my $fh, '-|', $rtlamr or die "unable to start rtlamr program $!"; my $disk_file = "somepath"; open my $disk_fh, '>>', $disk_file or die "unable to open disk history file! $!"; while (<$fh>) # this is a "blocking" read of radio receiver { print $disk_fh $_; $disk_fh-> flush; # update disk file immediately } __END__ That's it. The analysis program of the disk file, "somepath" is a separate program.