open my $PIPE, '-|', 'my-first-program', 'arg1', 'arg2' or die $!; while (my $line = <$PIPE>) { chomp; # ... do something with the line } close $PIPE or die $!;