in reply to Marking an array as already seen
Tie::RefHash comes with perl.
I don't think I'd use Memoize.
Untested:
use Tie::RefHash; { tie my %refhash, 'Tie::RefHash'; sub canonicalize_array { my $ref = shift; return $ref if exists $refhash{$ref}; # Otherwise canonicalize the array. $refhash{$ref}++; $ref; } }
Edit: Added the obvious $refhash{$ref}++; line.
-sauoq "My two cents aren't worth a dime.";
|
|---|