#!/usr/bin/perl $key = 1; $key1 = "test"; $key2 = ""; $key3 = 0; if (($key ne "") && ($key != 0)){ print "\n$key\n"; } OUTPUT : Correct For $key : 1 Incorrect For $key1 : Correct For $key2 : Incorrect For $key3 :