in reply to reading from an arbitrary number of files using anonymous file handles

You can use readline instead of the <angle brackets>

... # my $this = <$files[$num]>; my $this = readline($files[$num]); ...
In order to take track of unique lines, you might want to complement:
unless( ... ) { ... $unique{$this}++; ... }