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" : "";
--
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/