"Chas Owens" schreef:
> Joseph L. Casale:
>> I want to script an "if" based on two conditions, var1=0 and var2=1.
>> Is there some quicker way to write this in one "if" statement like:
>>
>> If ($var1=0 ?and? var2=1) {
>> Do my stuff
>> }
>>
>> I know I can nest a second if, but ju
On Tue, Jul 03, 2007 at 02:42:29AM -0400, Chas Owens wrote:
> On 7/3/07, Paul Johnson <[EMAIL PROTECTED]> wrote:
> snip
> >And, in this case, more accurate. Unless you know something the rest of us
> >don't.
> snip
>
> The trinary operator (?:) returns the value of either the true or
> false port
On 7/3/07, Paul Johnson <[EMAIL PROTECTED]> wrote:
snip
And, in this case, more accurate. Unless you know something the rest of us
don't.
snip
The trinary operator (?:) returns the value of either the true or
false portion depending on the conditional portion, so putting print
in both the true
On Tue, Jul 03, 2007 at 01:31:59AM -0400, Chas Owens wrote:
> On 7/3/07, Prabu Ayyappan <[EMAIL PROTECTED]> wrote:
> >You can even do like this
> >
> >$var1 == 0 && $var2 == 1 ? print "hai" : print "bye";
> snip
>
> If you are going for succinctness, then try this
>
> print !$var1 && $var2 ? "h
On Mon, Jul 02, 2007 at 11:28:47PM -0600, Joseph L. Casale wrote:
> Heh, I never tried to use "and"? I assumed it wasn't that simple! Problem
> with learning something from the beginning is I don't even know what that's
> called so searching the net is rather hard:)
Of course, searching the net
On 7/3/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Heh, I never tried to use "and"? I assumed it wasn't that simple!
snip
Well, it is a little more complicated than that. There are three and
operators in Perl: bitwise (&), high precedence logical (&&), and low
precedence logical (and). In
On 7/3/07, Prabu Ayyappan <[EMAIL PROTECTED]> wrote:
You can even do like this
$var1 == 0 && $var2 == 1 ? print "hai" : print "bye";
snip
If you are going for succinctness, then try this
print !$var1 && $var2 ? "hai" : "bye";
But in general, you are better off using the longer forms as they
Owens [mailto:[EMAIL PROTECTED]
Sent: Monday, July 02, 2007 11:05 PM
To: Joseph L. Casale
Cc: beginners@perl.org
Subject: Re: Conditional question
On 7/3/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
> I want to script an "if" based on two conditions, var1=0 and var2=1.
>
You can even do like this
$var1 == 0 && $var2 == 1 ? print "hai" : print "bye";
Thanks and Regards,
Prabu.M.A
"Joseph L. Casale" <[EMAIL PROTECTED]> wrote:
I want to script an "if" based on two conditions, var1=0 and var2=1.
Is there some quicker way to write this in one "if" stateme
On 7/3/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
I want to script an "if" based on two conditions, var1=0 and var2=1.
Is there some quicker way to write this in one "if" statement like:
If ($var1=0 ?and? var2=1) {
Do my stuff
}
I know I can nest a second if, but just hoped
10 matches
Mail list logo