On 2/8/10, Chris Coggins <cacogg...@cox.net> wrote:
> What is the proper syntax for a comparison at the end of a subroutine to
> stop the script if a certain variable is "0" or ''?
>
> sub routine{
> (get data and process it)
> if $varA = '' || $varA = "0" {
> (stop script, print error message to user)
> }
> else{
> (continue with script)
> }
>

if ($varA = '' || $varA = "0") {  #space after 'if'
    #code
}
else { #space after 'else'
    #code
}

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to