Solved

How to return from Perl

Posted on 2008-10-16
4
219 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
[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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…

737 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