Yes, there exist a hash table solution. Though I think it's not fast or elegant. The time complexity should be O(N*M). My idea is using a hash table to record which lines we already found on the islands. If a new line is not in the hash table, then add it into the hash table. If it's already in the hash table, then it cannot be a perimeter, as it is shared by two islands. Then just remove it from the hash table (since one line can only associated with one or two islands in this problem setting). Finally just return the length of the hash table should work.
The advantage of this solution is that it do not use recursion and is quite easy to code.