... run3 "somecommand -i somefile -o someoutputfile", $stdout, $stderr; while(my $line = <$stdout>) { if($line =~ m/Progress: (\d+) lines processed/) { # Assume that $ws is the web socket object I have created and will allow for the message to be sent... $ws->send($1); } }