open STDOUT, "| /bin/gzip >| /logfile.gz"; system("my command", "arg1", "arg2") #### open STDOUT, "/logfile"; system("my command", "arg1", "arg2") system("gzip","-f","/logfile");