DB<1> $arr=[]
DB<2> bless $arr,"_SEEN_"
DB<3> p ref $arr
_SEEN_
DB<4> bless $arr,"_UNSEEN_"
DB<5> p ref $arr
_UNSEEN_
You wont have any collision risk and you can safely pass the refs around with the information attached without caring about any extra %seen hash.
UPDATE: I just noticed that (unfortunately) there is no way to "unbless" references in perl afterwards! :-(
You may write bless $arr,"ARRAY" to try undoing blessing but even if ref now returns "ARRAY" it's NOT the same as "unblessing" and may cause subtle bugs ... just check it with Scalar::Util::blessed $arr ! Pity! |