Capture output but suppress it to screen

Posted on 2003-03-09
Medium Priority
Last Modified: 2008-03-04
Using perl with cygwin, i want to run an executable and capture its output but supress what is normally viewed in the console.

Say I run a dos box and type  "program.exe" and the screen outputs:

how are you

What I want is to run "perl.exe test.pl" with the following script

print "this is all that should show on screen"

and somehow supress the normal "hello how are you" output from showing on the screen.

Any ideas?

I'll raise points if this proves to be more complicated.
Question by:s_mack
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 8098983
nevermind... my question actually answered itself.

It seems that $output=`program.exe` DOES suppress the video output :P

So first person to put anything remotely intelligent, funny, or something other than "give me the points" gets the points.  Have a good one.
LVL 26

Accepted Solution

wilcoxon earned 80 total points
ID: 8099022
Yes.  `command` suppresses the output (more precisely, it puts it into $output).

Another option is:

open CMD, 'command |' or die "could not open pipe: $!";
while (<CMD>) {
    # do whatever you want with each line of output
close CMD;

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question