Help for this page

Select Code to Download


  1. or download this
    select(STDERR);$|=1;select(STDOUT);$|=1;   # autoflush
    print "This is the prompt: ";
    my $input = <STDIN>;
    print "done.\n";
    
  2. or download this
    select(STDERR);$|=1;select(STDOUT);$|=1;   # autoflush
    $cmd = 'perl b.pl 2>&1';
    system($cmd);
    
  3. or download this
    select(STDERR);$|=1;select(STDOUT);$|=1;   # autoflush
    $cmd = 'perl b.pl 2>&1 |';
    open(CMD, $cmd) or die "error: open '$cmd': $!\n";
    while (<CMD>) { print }  # and print to log file here too
    close(CMD);
    
  4. or download this
    select(STDERR);$|=1;select(STDOUT);$|=1;   # autoflush
    $cmd = 'perl b.pl 2>&1 | tee -a logfile.txt';
    system($cmd);