Solved

How to return from Perl

Posted on 2008-10-16
4
195 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

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

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

11 Experts available now in Live!

Get 1:1 Help Now