#! 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', $/; } }