Nov 15, 2006 #1 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"; }
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"; }
Nov 15, 2006 #2 MillerH Programmer Joined Oct 20, 2006 Messages 919 Location US http://perldoc.perl.org/functions/defined.html Code: if ([COLOR=blue]defined[/color] $Var && $Var == 1) { print "foo"; } Upvote 0 Downvote
http://perldoc.perl.org/functions/defined.html Code: if ([COLOR=blue]defined[/color] $Var && $Var == 1) { print "foo"; }
Nov 15, 2006 1 #3 KevinADC Technical User Joined Jan 21, 2005 Messages 5,070 Location US Code: if (!$Var || $Var == 1) { print "foo"; } - Kevin, perl coder unexceptional! Upvote 0 Downvote
Nov 15, 2006 #4 MillerH Programmer Joined Oct 20, 2006 Messages 919 Location US Welcome back from your vacation Kevin Upvote 0 Downvote
Nov 15, 2006 Thread starter #5 Extension Programmer Joined Nov 3, 2004 Messages 311 Location CA Thanks Kevin. It was a super easy one, but thank you for the quick response ! Upvote 0 Downvote
Nov 15, 2006 #6 KevinADC Technical User Joined Jan 21, 2005 Messages 5,070 Location US Thanks Miller. While I'd still rather be on vacation it's also good to be back. - Kevin, perl coder unexceptional! Upvote 0 Downvote
Thanks Miller. While I'd still rather be on vacation it's also good to be back. - Kevin, perl coder unexceptional!