Solved

How to return from Perl

Posted on 2008-10-16
4
205 Views
Last Modified: 2012-05-05
I have an enterprise scheduler that's calling a Perl script and they are saying that they need a return code rather than the perl script printing out the results.  I tried to use return, but got an error that says "can't return outside a subroutine".  How do I return from the main in perl?  thanks
0
Comment
Question by:jhughes4
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 22733344
perldoc -f exit
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 500 total points
ID: 22733523

#If everything is okay
exit(0);
 
#If there was a problem
exit(1);  #or some other non-zero number

Open in new window

0
 
LVL 84

Expert Comment

by:ozo
ID: 22733625
Did you read the documentation I referenced?
0
 
LVL 39

Expert Comment

by:Adam314
ID: 22733730
Sorry ozo... I skipped over your comment when I made my post.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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 …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

805 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