input from command prompt

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??
palanvinodAsked:
Who is Participating?
 
ThomyConnect With a Mentor Commented:
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
 
martinagCommented:
$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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.