[San-Diego-pm] A puzzler

Mark T. Johnson markj at matzsoft.com
Wed May 3 00:20:58 PDT 2006


Hi Dave,

My perl -v is:

This is perl, v5.8.6 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

etc.

Both values are calculated like $local->{retail} = $nr - $tr;

I could send the entire sub if you want to wade through it, but I 
think the above is enough.

Thanks,
Mark


>Hi Mark,
>On 5/2/06, Mark T. Johnson <markj at matzsoft.com> wrote:
>>Here's one that has me scratching my head.  How can you have 2
>>scalars that are eq but not ==?  Sample output from perl -d
>>
>>    DB<20> x $deltas{retail}
>>0  2
>>    DB<21> x $local->{retail}
>>0  2
>>    DB<22> x $deltas{retail} == $local->{retail}
>>0  ''
>>    DB<23> x $deltas{retail} eq $local->{retail}
>>0  1
>>
>>Is it some how treating one as numeric and the other not?
>I honestly don't know the solution to your problem. What version are
>you using? Here's what I did to try to duplicate the problem:
>paperweight:~ dromano$ perl -v; perl -d -e '$local->{retail} = "2";'
>-e '$deltas{retail} = "2";' -e '$local->{retail} = 2;' -e
>'$deltas{retail} = 2;' -e '$local->{retail} = "2";' -e '1;'
>
>This is perl, v5.8.8 built for darwin-2level
>
>Copyright 1987-2006, Larry Wall
>
>Perl may be copied only under the terms of either the Artistic License or the
>GNU General Public License, which may be found in the Perl 5 source kit.
>
>Complete documentation for Perl, including FAQ lists, should be found on
>this system using "man perl" or "perldoc perl".  If you have access to the
>Internet, point your browser at http://www.perl.org/, the Perl Home Page.
>
>
>Loading DB routines from perl5db.pl version 1.28
>Editor support available.
>
>Enter h or `h h' for help, or `man perldebug' for more help.
>
>main::(-e:1):   $local->{retail} = "2";
>  DB<1> n
>main::(-e:2):   $deltas{retail} = "2";
>  DB<1> n
>main::(-e:3):   $local->{retail} = 2;
>  DB<1> x $deltas{retail}
>0  2
>  DB<2> x $local->{retail}
>0  2
>  DB<3> x $deltas{retail} == $local->{retail}
>0  1
>  DB<4> x $deltas{retail} eq $local->{retail}
>0  1
>  DB<5> n
>main::(-e:4):   $deltas{retail} = 2;
>  DB<5> x $deltas{retail}
>0  2
>  DB<6> x $local->{retail}
>0  2
>  DB<7> x $deltas{retail} == $local->{retail}
>0  1
>  DB<8> x $deltas{retail} eq $local->{retail}
>0  1
>  DB<9> n
>main::(-e:5):   $local->{retail} = "2";
>  DB<9> x $deltas{retail}
>0  2
>  DB<10> x $local->{retail}
>0  2
>  DB<11> x $deltas{retail} == $local->{retail}
>0  1
>  DB<12> x $deltas{retail} eq $local->{retail}
>0  1
>  DB<13> n
>main::(-e:6):   1;
>  DB<13> x $deltas{retail}
>0  2
>  DB<14> x $local->{retail}
>0  2
>  DB<15> x $deltas{retail} == $local->{retail}
>0  1
>  DB<16> x $deltas{retail} eq $local->{retail}
>0  1
>
>
>Can you provide any more context? How are the variables being assigned?
>
>David


-- 
--------------------------------------------------------------
Mark T. Johnson
MATZ Software & Consulting
Phone: 858-571-3125
FAX:   858-452-2871


More information about the San-Diego-pm mailing list