http://www.perlmonks.org?node_id=1032974


in reply to Check if sort has changed order

Use Digest::MD5 to see if something has changed. The md5_hex() function will concatenate its arguments then operate on the concatenated string.

$ perl -Mstrict -Mwarnings -MDigest::MD5=md5_hex -E ' my @arr1 = qw{ tiger bear shark lion }; say md5_hex( @arr1 ); say md5_hex( sort @arr1 );' 4c15f2e87b25ac112649edfd426d5082 27f304e4e99072211806f923bbb39705 $ perl -Mstrict -Mwarnings -MDigest::MD5=md5_hex -E ' > my @arr1 = qw{ antelope cow deer sheep }; > say md5_hex( @arr1 ); > say md5_hex( sort @arr1 );' 1f0210f9b5d6dababea92da7018905da 1f0210f9b5d6dababea92da7018905da $

I hope this is of interest.

Cheers,

JohnGG