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 case of nested ternary operators) scalar values. I would probably write the code above like this: die "bad value in \$string: $string" unless $string eq 'test'; print "correct"; -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/