in reply to errors

It's telling you that when you read a line from a file (the <HANDLE> construct), the value of that line can be "0" (0 without a newline following it). This would evaluate to false, which probably isn't what you want, because you could exit the loop too early this way (before eof).

So what you should do is test for the defined-ness of the value:

while (defined($_ = <>) and $_ ne "quit\n") { ...
By the way, you really don't need to build the @dupes array in the above example; you have all the information you need in your hash. The duplicate lines are the keys in the hash where the value is greater than 1:
my @dupes = grep $lines{$_} > 1, keys %lines;
Just something to think about.

And by the way, here's a one-liner that does basically the same thing:

% perl -ne 'END { print grep $s{$_}>1, keys %s } last if $_ eq "qu +it\n"; $s{$_}++' file
I'm sure someone else could shorten this. :)