Solved

input from command prompt

Posted on 1998-12-13
2
159 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

21 Experts available now in Live!

Get 1:1 Help Now