Command line output: display concerns

Posted on 2006-05-04
Last Modified: 2010-03-05
I have a cgi Perl file that runs an exe file in command prompt. Although I never used a print command in perl, the web page displays the results. I need a way to stop displaying the results. I tried @some_array = `$command`;
Didn't work.
Question by:n4narik
    LVL 5

    Expert Comment

    On windows (I assume windows due to the exe file) try:
      `$command > nul 2> nul`;
    on unix try
      `$command > /dev/null 2> /dev/null`;

    This way all output and error output of $command is redirected into nirvana. (You will also not be able to retrieve a result from that command in perl).
    LVL 48

    Expert Comment

    Do you need to capture the output?


    my $output = `$command 2>&1`;
    LVL 11

    Accepted Solution

    Put this JUST under the shebang line, like so...

    BEGIN {
    open (STDERR, ">/path/to/somewhere/error.txt");


    ~K Black~

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
    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…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now