Question: I am trying to set the value of an immutable object using `.set()`. The value updates as it should, but I can't fetch from the object using `.getIn()` afterwards. I think this is because it's not deep setting the children of the object as immutable. Is there any method in immutable.js that will allow me to do this? I know I can wrap the object in `fromJS()` like `.set(fromJS('rooms', roomMap))` but this seems messy. What is the correct way to do this?

```
  const state = Immutable.fromJS({
      rooms: false
  });

  const roomMap = 
  {
      "roomid1": {
          "id": "roomid1",
          "name": "Room 101",
      },
      "roomid2": {
          "id": "roomid2",
          "name": "Room 102",
      },
  };

  var newState = state.set('rooms', roomMap);
  console.log(newState.getIn(['rooms', 'roomid1']));;

```

<https://jsfiddle.net/z0a4p199/1/>

Answer: 
You can simply do that *(note that I changed the second `cmp` to the shuttle operator `<=>` for numeric values)*:

```
foreach (sort { ($hash{$a}=~s/^\W+//r cmp $hash{$b}=~s/^\W+//r) || ($a <=> $b) } keys %hash) {
    print "$hash{$_}\n";
}

```

But if you have a lot of data, it's better to transform your data *(once and for all)*:
For example using a schwartzian transform:

```
my @result = map { $_->[2] }
             sort { ($a->[0] cmp $b->[0]) || ($a->[1] <=> $b->[1]) }
             map { [ $hash{$_}=~s/^"|"$//gr, $_, $hash{$_}] } keys %hash; 

print join "\n", @result;

```
Use a custom sort function that strips out the characters you want to ignore.

```
foreach (sort {
            my ($aa,$bb) = ($hash{$a},$hash{$b});
            s/["]//g for $aa,$bb; # ignore " char. Add whatever else you want
            $aa cmp $bb           # or lc($aa) cmp lc($bb) case-insensitive search
                || $a cmp $b
       } keys %hash) { ... }

```