in reply to Re^2: What does 'next if $hash{$elem}++;' mean?
in thread What does 'next if $hash{$elem}++;' mean?

You'll need to define "doesn't work" (aside from the obvious problems of not checking the return value from your opens, or redefining @unique, or not printing newlines in the last foreach, or that you seem to be doing redundant work with both the map { $_, 1 } @array and the subsequent foreach).