Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am calling a perl .pl file from a batch file. I want the perl file to return different status values when it is run to the batch file....how can I do that?

I put a 'return $status' at the end of the perl file, but it complains it is not a subroutine. Please suggest.

Thank you.

Replies are listed 'Best First'.
Re: perl file returning values
by socketdave (Curate) on Jul 22, 2005 at 17:03 UTC
    You want to do:   exit $status;...

Re: perl file returning values
by holli (Abbot) on Jul 22, 2005 at 17:56 UTC
    script:
    !perl exit shift;
    batch file
    @echo off call el.pl %1 echo %errorlevel%


    holli, /regexed monk/
      Thank you
Re: perl file returning values
by ww (Archbishop) on Jul 22, 2005 at 17:02 UTC
    If you'll show us your "perl .pl file," we may be able to help.

    Knowing how you're creating the variable is sorta' important.

    update: d'uh; see below. misread. Advice above is generic but not necessary here.