[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Command line output: display concerns

Posted on 2006-05-04
3
Medium Priority
?
201 Views
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.
0
Comment
Question by:n4narik
3 Comments
 
LVL 5

Expert Comment

by:wlfs
ID: 16607136
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).
0
 
LVL 48

Expert Comment

by:Tintin
ID: 16610832
Do you need to capture the output?

Try

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

Accepted Solution

by:
kblack05 earned 2000 total points
ID: 16641647
Put this JUST under the shebang line, like so...

#!/usr/bin/perl
BEGIN {
open (STDERR, ">/path/to/somewhere/error.txt");
}

Regards,

~K Black~
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
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

834 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