Pregunta

Is there some data structure in Perl like LinkedHashMap in java?

Or something LRU data structure in Perl

Update:@TLP Basically I'd like to have Hashtable data structure but also I can keep the order of keys coming in, remove keys after I process the key in the list.

Update:@ccheneson Tie::IxHash one seems not what i want, I would like to POP an oldest key, but tie::ixHash pop up the latest key, How I get the oldest key value pair in Tie::IxHash? I'd like to have a queue Structure (and Hash Structure as well, I'd like to find the key in the easiest way), new Key,value pair keeps coming in and I keep process oldest Key and remove the oldest key.

Update:@ FMc Tie::IxHash is What I need, Tie::IxHash->Shift() does a queue pop Tie::IxHash->Push() does queue push and it is hash structure and easy to find keys.

Thanks all.

¿Fue útil?

Solución

Tie::IxHash seems to be what you are looking for.

Tie::IxHash - ordered associative arrays for Perl

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top