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: 
Create a function which truncates special characters (`truncate_special_chars` in my case). Then, use it under your `sort` routine.

```
use strict;
use warnings;

my %hash = (
    5328 => 'Adorable',
    26191 => '"Giraffe"',
    57491 => 'Is Very',
    4915 => 'Cute',
    );

print join "\n", 
    map { $hash{$_ -> [0]} }
    sort { $a -> [1] cmp $b -> [1] || $a -> [0] <=> $b -> [0] }
    map { [ $_, truncate_special_chars($hash{$_}) ] }
    keys %hash;

sub truncate_special_chars {
    my $str = shift;
    $str =~ s/^\W//;
    # may be use lc if you want case insensitive sort
    return $str;
}

```

Otherwise you can use `/r` if you are using `Perl >= 5.14`.
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) { ... }

```