in reply to Reconstructing List Order From Partial Subsets

Hi QM,

How about using a hash, with the key being the string item, and the value being an index, which gets incremented each time you find a new string.

Then you can sort numerically on the values of the hash to get the original order.

Is that what you're looking for?

Update:  After rereading your question more carefully, it looks like that doesn't work.  But perhaps if you use a hash where the value corresponding to each string is a hash, within which each key is the number of times "Start" has been found, and the value is the index within that sublist.  You'll know an item isn't in a given sublist, because the corresponding key won't be defined.

For example:

Start # This is sublist #1 Alpha # $p->{'Alpha'}->{'1'} => 1 Beta # $p->{'Beta'}->{'1'} => 2 Start # This is sublist #2 Epsilon # $p->{'Epsilon'}->{'2'} => 1 Zeta # $p->{'Zeta'}->{'2'} => 2 Start # This is sublist #3 Beta # $p->{'Beta'}->{'3'} => 1 Gamma # $p->{'Gamma'}->{'3'} => 2 Zeta # $p->{'Zeta'}->{'3'} => 3 Start # This is sublist #4 Alpha # $p->{'Alpha'}->{'4'} => 1 Gamma # $p->{'Gamma'}->{'4'} => 2 Delta # $p->{'Delta'}->{'4'} => 3 Epsilon # $p->{'Epsilon'}->{'4'} => 4 would give a hash like: $p = { 'Alpha' => { # Note 'Alpha' doesn't appear in sublist #2 or #3 1 => 1, # Alpha is #1 in the 1st sublist 4 => 1, # Alpha is #1 in the 4th sublist }, 'Beta' => { 1 => 2, 3 => 1, }, 'Epsilon' => { 2 => 1, 4 => 4, }, 'Zeta' => { 2 => 2, 3 => 3, }, 'Gamma' => { 3 => 2, 4 => 2, }, 'Delta' => { 4 => 3, }, };

Does something like that help you?


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/