"Tanton Gibbs" <[EMAIL PROTECTED]> wrote in message 010501c2b292$2ff54e10$[EMAIL PROTECTED]">news:010501c2b292$2ff54e10$[EMAIL PROTECTED]... > also: > print (hi), $somevar++ if( condition );
Yes, but you have to be careful with parentheses as print "hi", $somevar++ if condition; is the same as print ("hi", $somevar++) if condition; which would print the unmodified value of $somevar. Something like: hi5 :-) Rob > ----- Original Message ----- > From: "Rob Dixon" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, January 02, 2003 1:04 PM > Subject: Re: One liner If statements > > > > do { > > print "hi"; > > $somevar++; > > } if condition; > > > > (You don't need to parenthesize the conditional expression in this > format.) > > > > HTH, > > > > Rob > > > > "Jensen Kenneth B Sra Afpc/Dpdmpq" <[EMAIL PROTECTED]> wrote > in > > message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > In reading messages on this list I've picked up some snippets like > > > > > > 'do some code here' if (condition); > > > > > > Can the same be done if you have an if statement like this > > > > > > If (condition){ > > > print "hi"; > > > $somevar++; > > > } > > > > > > Or can you only have 1 command preceding the if? > > > > > > I tried > > > > > > Print "hi" $somevar++ if (condition); #compile error > > > Print "hi" | $somevar++ if (condition); #compiles but $somevar++ does > not > > > increment > > > Print "hi" || $somevar++ if (condition); #compiles but $somevar++ does > not > > > increment > > > Print "hi" && $somevar++ if (condition); #compiles but $somevar++ does > not > > > increment > > > > > > Thanks, > > > Ken > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]