Greetings,

I have several places in my code where I need to check if two string 
variables are empty, if one is empty and the other is not, and if they're 
both populated.

Is there any simpler way to write the code than this?:

if($var1 ne "" and $var2 ne "") {
    # Both are populated...
    # ...
}
elsif($var1 ne "" or $var2 ne "") {
    # One or the other is populated...
    # ...
}
else {
    # Neither are populated...
    # ...
}

The reason I ask is that some of the code gets to be fairly long when I'm 
checking things this way, and so I just wondered if there was any 
shorthand/shortcut way to have Perl check if two strings are empty in one 
expression...regular expressions, maybe?  I appreciate any help, 
suggestions, or answer you can provide.

Thanks,

Vance



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to