open my $lsfh, "-|", "ls", "-l" or die "Cannot open pipe from 'ls': $!"; while (<$lsfh>) { print; } close $lsfh;