Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditionals ... 1

Status
Not open for further replies.

Extension

Programmer
Joined
Nov 3, 2004
Messages
311
Location
CA
Hi,

I can't believe I'm asking this... but I some trouble with two conditions I want to keep as a "one liner".

So I want;
If $Var is define, check if $Var equals 1
If $Var is not define, don't check if it equal 1

Code:
if ($Var && $Var == 1) {
	print "foo";
}

 
Code:
if (!$Var || $Var == 1) {
    print "foo";
}

- Kevin, perl coder unexceptional!
 
Welcome back from your vacation Kevin [sunshine]
 
Thanks Kevin. It was a super easy one, but thank you for the quick response !

 
Thanks Miller. While I'd still rather be on vacation it's also good to be back. [cheers]

- Kevin, perl coder unexceptional!
 
Status
Not open for further replies.

Similar threads

Replies
19
Views
384
  • Locked
  • Question Question
Replies
9
Views
174

Part and Inventory Search

Sponsor

Back
Top