Solved

input from command prompt

Posted on 1998-12-13
2
165 Views
Last Modified: 2010-03-05
I have an exe running which helps me to add user email via
form and if same user is present it sents error  so my question is if how do I catch the above error since error comes at command prompt??
0
Comment
Question by:palanvinod
[X]
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
2 Comments
 
LVL 4

Expert Comment

by:martinag
ID: 1206935
$result = `program.exe parameters`; # notice the backticks!

Check if $result is some kind of error message. For example you could use
if ($result =~ /error/) {
  # There was an error
}

Martin
0
 

Accepted Solution

by:
Thomy earned 50 total points
ID: 1206936
You can open a pipe with perl instead executing it with system or backticks. You execute your program and read the stdout from it.

open (DATE, "date.exe |") or die "Can't open date.exe";
while (<DATE>) {
    $out .= $_;
}
close(DATE);
# do something with $out
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Remove Malware code from PHP file 6 98
Transforming a Soap message to a simple xml message! 10 154
File Find regex problem 4 68
Export Variables in Perl 3 105
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…
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…

756 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