#! perl -sw use strict; use FreezeThaw qw(cmpStr freeze); sub asStr { return 'undef' if !defined $_[0]; return "''" if $_[0] eq ''; return '0' if $_[0] == 0; "$_[0]"; } my @x = (0,1,'',undef); my @y = (0,1,'',undef); print ' {$^W=0; ($x eq $y)', "\t", '!cmpStr($x,$y)', $/; for my $x (@x) { for my $y (@y) { printf '%5s -v- %5s :', asStr($x), asStr($y); print "\t", do{local $^W=0;($x eq $y) ? 'Same' : 'Diff';}; print "\t\t",!cmpStr($x,$y) ? 'Same' : 'Diff', $/; } } #### C:\test>test {$^W=0; ($x eq $y) !cmpStr($x,$y) 0 -v- 0 : Same Same 0 -v- 1 : Diff Diff 0 -v- '' : Diff Diff 0 -v- undef : Diff Diff 1 -v- 0 : Diff Diff 1 -v- 1 : Same Same 1 -v- '' : Diff Diff 1 -v- undef : Diff Diff '' -v- 0 : Diff Diff '' -v- 1 : Diff Diff '' -v- '' : Same Same '' -v- undef : Same Diff # Here! undef -v- 0 : Diff Diff undef -v- 1 : Diff Diff undef -v- '' : Same Diff # Here! undef -v- undef : Same Same 1:13:29.67 C:\test>