$name is variable where as $$name is reference variable like $name=gim and $$name=singh so $jim value is smith.
like $name=gim and $$name=singh so $jim value is smith.