#!perl use strict; use warnings; use IPC::Open2; eval { my $pid = open2(\*OUT, \*IN, 'findstr hello'); }; if ($@ and $@ =~ /^open2:/) { die "$@:$!\n"; } my $sometext = <; print join " ", @found;