http://www.perlmonks.org?node_id=156056


in reply to comparing two values under 'perl -w'

How about creating a sub to do this?

#!/usr/bin/perl -w use strict; sub SpecialEqual { my $pVal1 = shift; my $pVal2 = shift; return 1 unless (defined $pVal1 or defined $pVal2); return (defined $pVal1 and defined $pVal2 and $pVal1 == $pVal2); } print 'Testing: 1,1 = ',SpecialEqual(1,1),"\n"; print 'Testing: 1,2 = ',SpecialEqual(1,2),"\n"; print 'Testing: 2,1 = ',SpecialEqual(2,1),"\n"; print 'Testing: 2,2 = ',SpecialEqual(2,2),"\n"; print 'Testing: 2,2.5 = ',SpecialEqual(2,2.5),"\n"; print 'Testing: 2.5,2 = ',SpecialEqual(2.5,2),"\n"; print 'Testing: 2.5,2.5 = ',SpecialEqual(2.5,2.5),"\n"; print 'Testing: undef,1 = ',SpecialEqual(undef,1),"\n"; print 'Testing: 1,undef = ',SpecialEqual(1,undef),"\n"; print 'Testing: undef,undef = ',SpecialEqual(undef,undef),"\n";

Update:

Maybe I should have read RMGir's reply, yes? *Smiles*