in reply to Re: Tie::Hash::Regex
in thread Tie::Hash::Regex

I was just having a very similar conversation with someone in the office about those possibilities. Didn't manage to come to any firm conclusions tho' :(

One thing we did think of - you could implement the delete function in such a way that it deleted every key that matched the regex (still some problems there tho' - what if the exact key of one element is also part of another key and would therefore match the regex?)

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: Re: Tie::Hash::Regex
by Masem (Monsignor) on May 11, 2001 at 18:14 UTC
    Another idea similar to your deleting but without modifying the hash would be to make the fetch function store the current position of where it is in the keys, then subsequent calls would start from that last position. Of course, you'd then need a secondary hash in the tie to keep track of this, and there would be no easy way to reset this short of a function call to trick it. Additionally, modification of the hash between subsequent calls would pose a problem.

    Just tossing out ideas here in case something triggers insight....


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain