The apt-get utilities are simply a front-end to the debian dpkg utility, which actually does the real work.
it’s possible for you to use this utility to figure out what version is installed.
It has many features to process textfiles and to do system management tasks (as in perl).