Using open to connect different processes
#!/usr/bin/perl
use warnings;
use strict;
open( DIR, "dir *.* |" ) or die( "Cannot open dir pipe: $!" );
open( MORE, "| more" ) or die( "Cannot open more: $!" );
while ( <DIR> ) {
print( MORE );
}
close( DIR ) or die( "Cannot close DIR: $!" );
close( MORE ) or die( "Cannot close MORE: $!" );
Related examples in the same category