Are you seeing this behavior on a multi-arch system (i.e. a system where `dpkg --print-foreign-architectures` has non-empty output)? I discovered that the keys method of AptPkg::Cache returns one copy of each package name for every architecture (so if you have 3 architectures, you'll see each package name 3 times). See Debian bug #707142.
** Bug watch added: Debian Bug tracker #707142 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707142 ** Also affects: libapt-pkg-perl (Debian) via http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707142 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/994509 Title: Duplicate packages entries en AptPkg::Cache To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/libapt-pkg-perl/+bug/994509/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs