Re: if condition question

2008-10-16 Thread Tom Yarrish
On Oct 16, 2008, at 8:08 AM, "John W. Krahn" <[EMAIL PROTECTED]> wrote: sanket vaidya wrote: Hi all, This is the exact same question you asked 16 days ago. Did you not like the answer you got then? (Which is the same as the answers you are getting now.) John -- Perl isn't a toolbox

Re: if condition question

2008-10-16 Thread John W. Krahn
sanket vaidya wrote: Hi all, This is the exact same question you asked 16 days ago. Did you not like the answer you got then? (Which is the same as the answers you are getting now.) John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools

Re: if condition question

2008-10-16 Thread Paul Johnson
On Thu, Oct 16, 2008 at 03:20:13AM -0700, Jeff Pang wrote: > --- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > > From: Chas. Owens [mailto:[EMAIL PROTECTED] > > > > > What you really want to say is > > > > > > print $string eq "test" ? "correct" : ""; print "correct" if $str eq "te

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 06:12, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > How can I write > > if ($string eq "test") { >print "correct" > } else { >die "others" > } > > In above way? snip In general, the ternary operator should only be used when choosing between two (or more in the ca

RE: if condition question

2008-10-16 Thread Jeff Pang
--- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > From: sanket vaidya <[EMAIL PROTECTED]> > Subject: RE: if condition question > To: beginners@perl.org > Date: Thursday, October 16, 2008, 6:12 AM > -Original Message- > From: Chas. Owens [ma

RE: if condition question

2008-10-16 Thread sanket vaidya
-Original Message- From: Chas. Owens [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2008 2:36 PM To: sanket vaidya Cc: beginners@perl.org Subject: Re: if condition question On Thu, Oct 16, 2008 at 04:54, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > Now when I write

Re: if condition question

2008-10-16 Thread Peter Scott
On Thu, 16 Oct 2008 14:24:56 +0530, sanket vaidya wrote: > use warnings; > use strict; Good! use warnings has shown you a bug in your code. > my $string = "test"; > > $string eq "test" ? print "correct" : ""; > > > Output: > > Correct > > Useless use of constant in void context at line 5.

Re: if condition question

2008-10-16 Thread Jeff Pang
--- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > From: sanket vaidya <[EMAIL PROTECTED]> > Subject: if condition question > To: beginners@perl.org > Date: Thursday, October 16, 2008, 4:54 AM > Hi all, > > > > Kindly go through th

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 05:05, Chas. Owens <[EMAIL PROTECTED]> wrote: snip > What the ternary operator* is saying is roughly equivalant to snip Whoops, left out the footnote: * http://perldoc.perl.org/perlop.html#Conditional-Operator -- Chas. Owens wonkden.net The most important skill a program

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 04:54, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > Now when I write the same if condition in program as below, I get warning > along with output. snip > $string eq "test" ? print "correct" : ""; snip > Useless use of constant in void context at line 5. snip What the ter

if condition question

2008-10-16 Thread sanket vaidya
Hi all, Kindly go through the below codes: use warnings; use strict; my $string = "test"; if ($string eq "test") { print "correct"; } Output: Correct Now when I write the same if condition in program as below, I get warning along with output. use warnings; use strict;

Re: if condition question

2008-09-29 Thread John W. Krahn
sanket vaidya wrote: Hi all, Hello, Kindly go through the below codes: use warnings; use strict; my $string = "test"; if ($string eq "test") { print "correct"; } Output: Correct Now when I write the same if condition in program as below, I get warning along with output. use warnings; use

if condition question

2008-09-29 Thread sanket vaidya
Hi all, Kindly go through the below codes: use warnings; use strict; my $string = "test"; if ($string eq "test") { print "correct"; } Output: Correct Now when I write the same if condition in program as below, I get warning along with output. use warnings; use strict; m