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;

my $string = "test";

$string eq "test" ? print "correct" : "";

 

Output:

Correct

Useless use of constant in void context at line 5.

 

Can any one suggest the reason of warning in Case2.

 

Thanks & Regards,

Sanket Vaidya 

 


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.
_____________________________________________________________________

Reply via email to