Hi Eliya,
Thanks a lot for the quick response !! It does work/display as I expected. It displays the error code that I am returning and the message. HOWEVER if I try this C:\perl>echo %ERRORLEVEL% command after execution of my script, I still get the value 0 for all the cases. Now am wondering if the above command is right or not for determinig the error code/exit code value.(I read somewehere that above command is equivalent of echo $? in linux).
If you actually do want to exit the program, and pass some exit code to the calling process, there's nothing wrong with using exit. In the above snippet, you could place the exit after the print, for example.