open my $fh, "-|", "ls -l" or die $!; while(defined(my $line = <$fh>)) { print $line; } close $fh or die "ERROR: Couldn't read from pipe: $!";