Archive::Tar can be problematic with big tarfiles (memory),
Archive::Tar::Wrapper is a wrapper around the system's
tar command and stores extracted files on disk. And (coincidence??) it comes with a
sample script that seems to do exactly what you want :).