use strict; use warnings; open NETSTAT, "netstat -e |" or die $!; while (){ # process the line # Output to csv } close NETSTAT;