Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
my $ref_array1 = @array1; my $ref_array2 = @array2; my $str = md5($ref_array1); my $str2 = md5($ref_array2);
You are doing a digest both times on the count of the items in the arrays, i.e:
print $ref_array1; print $ref_array2;

Even if you actually took a reference to to these arrays, (my $ref_array1 = \@array1;) your solution would never work, as you would be digesting just a memory code/id for the two named arrays.
The solution here is I suspect, to serialize the arrays & digest the stringified values, e.g:
#!/usr/bin/env perl use Modern::Perl; use Data::Dumper; use Digest::MD5 qw(md5 md5_hex md5_base64); my @array1 = ( [1,'John','ABXC12132328'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'] ); my @array2 = ( [0,'John','ABXC12132322'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'], [0,'John','ABXC12132322'] ); my @array3 = @array2; #print Dumper(\@array1); my $md5_1 = md5_hex(Dumper(\@array1)); my $md5_2 = md5_hex(Dumper(\@array2)); my $md5_3 = md5_hex(Dumper(\@array3)); say 1,' ',$md5_1; say 2,' ',$md5_2; say 3,' ',$md5_3;

This is not a Signature...

In reply to Re: Checksum on Multidimentional Array - how does it work by monkey_boy
in thread Checksum on Multidimentional Array - how does it work by udvk009

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2021-07-31 10:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found