Solved

How to return from Perl

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
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…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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

19 Experts available now in Live!

Get 1:1 Help Now