I believe that you can only use last in a 'for' statement and 'do
while/until' loops.  Instead of 'last', try using 'return' with null
characters.  See below.

-jay

-----Original Message-----
From: John Deretich [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 09, 2002 12:57 PM
To: '[EMAIL PROTECTED]'
Subject: last


Hi ,

is any one familiar with using a last statement
when exiting a subroutine?
Here's the code that I am working with:

use strict;
        
      my $logdrive=undef;                               #Establishing
variable;
      my $logdrive1=undef;                              #Establishing
variable;               
      my $logdrive = env_variable("varname");   #invoking subroutine to find
env variable
      my $logdrive1 = env_variable("varname");  #invoking subroutine to find
env variable
            
sub env_variable {
  my $returnvar=undef;                                   
   if (($_[0] ne 'varname') or ($_[0] ne 'varname')) {  #verify if correct
variable is passed
        return "";  #last;                    #Terminate and continue if the
variable is
incorrect
      }                                   
         if ($_[0] = 'varname') {                         #verify if the
correct value is passed 
               if ( ( -e ($logdrive=$ENV{"varname"})) && ($logdrive =~
/^(.*\w+)/i)) {  #Verfiy the value is a-z,0-9,ignore case
                print "Running environment variable logdrive on the
workstation\n";
                  }
            }
         else   {
                $returnvar = 'R';
#Setting default value
                print "Running default variable logdrive on the
workstation\n";
                print "$returnvar \n"
          }
     return $returnvar;
    }

I am receiving the following error message: "can't "last" outside a block"

please advise,

John
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the individual or entity to 
whom they are addressed.  If you have received this email
in error destroy it immediately.
**********************************************************************
             Wal-Mart Stores, Inc. Confidential
**********************************************************************

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to