in reply to Re^2: Fast way to check if a sort was done (using stringification is *broken*)
in thread Fast way to check if a sort was doen
Nice solution! I didn't know about '/' in pack.
It's not quite perfect, though. It treats the empty string and undef as equal (there may be more ways to break it - this is just the first one I thought of):
my $signature_1 = pack( '(J/a*)*', '', undef ); my $signature_2 = pack( '(J/a*)*', undef, '' ); printf( "Signatures are %s\n", ( $signature_1 eq $signature_2 ) ? 'equal' : 'unequal' ); # eq +ual!
These cases were not specified in the OP. I apologize for being pedantic. :-)
|
|---|