Firstly, sorry for mis-spelling your name.

I also apologies for misunderstanding your intent. In the context of the thread, I looked at what FreezeThaw did, and couldn't see the difference between what it did in cmpStr($x,$y) and do{no warnings; $x eq $y). However, as I finally got FreezeThaw.pm installed on my system (actually just copied in as the install mechanism gave me inordanant troubles), I realise that it does more as my test script below shows.

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

Giving

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>

Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

In reply to Re: Re: Re: (Golf) Warningless Comparison by BrowserUk
in thread (Golf) Warningless Comparison by tadman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.