in reply to md5_hex diff input produces same output?

A simple test script shows that that's not the case.

use strict; use Digest::MD5 qw( md5_hex ); my $string1="CA" . "Los Angeles" . "1440x900" . "en-us" . "Mozilla/4.0 + (compatible; MSIE 6.0; Windows NT 5.1; SV1)" . ""; my $string2="CA" . "Los Angeles" . "1280x1024" . "en-us" . "Mozilla/4. +0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; M +edia Center PC 5.0; .NET CLR 3.0.04506)" . ""; print md5_hex( $string1 ), "\n", md5_hex( $string2 ), "\n"; exit 0; __END__ 256645dc3bb33cfd395c51faf4241cfc c3fbc65ae0b12ee4cd22ccadd3d9a3f7

Something Else Is Wrong™, but then you haven't shown any actual code so it's all pretty much going to be conjecture.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: md5_hex diff input produces same output?
by Oaty (Acolyte) on Mar 24, 2009 at 16:56 UTC
    Thanks fletch my test script proved the same is yours. ... I'm prepared for a well deserved beating now. While preparing to copy my code for you I noticed the value I was passing to the database was not the output from MD5 but an un-initialized hashref value. I so wish I could use strict at this job! Thanks for pointing me back to the code Fletch! Oaty

      You can always use strict;, as it's a lexically scoped pragma:

      ... horrible code ... sub my_new_code { use strict; ... }; ... more code from the wasteland ...

      You might or might not need to declare the global variables you need using use vars;, but at least all new code can be run under strict that way.

        You might or might not need to declare the global variables

        In the spirit of keeping things local,

        ... horrible code ... sub my_new_code { use strict; our $global; ... }; ... more code from the wasteland ...