Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Remove the duplication in Hash values

by SimonClinch (Deacon)
on May 20, 2011 at 08:18 UTC ( #905879=note: print w/replies, xml ) Need Help??

in reply to Remove the duplication in Hash values

If I understand correctly, you can't! Or at least, the array locations 0 and 0 thru 10 in the respective arrays in the output hash will have been autovivified giving existing addresses (test with exists()) populated however with undef(), although those above the upper limit you defined will not have come into existence.

Update: You probably want just arrays (ie reconsider the storage model) of [0..9] and to iterate them afresh for each key iteration of the containing hash when reading and writing to the hash.

Oops a cow flew by. Therefore a corrected response: There need to be clearer rules for the deletion - must the solution be contiguous? ie must it allow gaps if there is no other way to include a set that doesn't overlap another - what if two ranges overlap but are of the same size with one higher than the other - how is a winner selected between them?

One world, one people

Replies are listed 'Best First'.
Re^2: Remove the duplication in Hash values
by lidden (Curate) on May 20, 2011 at 10:54 UTC
    No, the [1..10] in %input=(r=>[1..10],s=>[1..10] is an array reference with values 1 to 10, which is possible. You cannot have an array without index zero, but nothing in the OP says he wants to do that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://905879]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-03-18 03:03 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (228 votes). Check out past polls.