use strict; use warnings; use threads; async{ open my $In, ...; open my $out, ...; while( <$in> ) { print $out; } }->join;