You can use the
exit function to return the value to the parent process. From the parent environment you can also get the return status. If you are using the *nix , you can fetch the exit status of the previous process by printing the env variable $?.
Hope the below example will help you!
#!/usr/bin/perl -w
use strict;
print "This is going to exit\n";
exit 2;
$> perl aboveProgram.pl
This is going to exit
$> echo $?
2
$>
Regards,
S.Venni Rajan.
"A Flair For Excellence."
-- BK Systems.