4 ms·
And just to be cute, this uses 2 pipes and is shorter (but I would not write it this way). #!/usr/bin/perl -w use strict; use English; use auto
by al_form2000 9y ago
And just to be cute, this uses 2 pipes and is shorter (but I would not write it this way).
#!/usr/bin/perl -w
use strict;
use English;
use autodie;
sub f { open(my $h,"/bin/ls $_[0]|") ; print "--\n",(<$h>),"--\n";}
open(my $o,">/tmp/out.txt") ; select $o ; f("/tmp") ;
open($o,"| wc -l ") ; select $o ; f("/tmp") ;