-----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 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 ternary operator* is saying is roughly equivalant to >if ($string eq "test") { print "correct" >} else { "" >} >>That empty string by itself is what is causing the warning. What you really want to say is >>print $string eq "test" ? "correct" : ""; How can I write if ($string eq "test") { print "correct" } else { die "others" } In above way? http://www.patni.com World-Wide Partnerships. World-Class Solutions. _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _____________________________________________________________________ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/