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
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