You are right. At first I thought it was a bug in my script, but then I realized that, as there is no way of recognizing a hard link as such, repeated runs of the program on the same directory will report identical results.
I'd like to add that you can distinguish hardlinks by inode numbers. When you have your group of duplicate-content files, hash them by inode numbers:
push @{ $hash{$inode} }, $path;
When you have more than one key in the hash, decide which hardlink's inode you like and
link the other paths to it.
When you have only one key in the hash, you're done!