in reply to tar sytem command

I think you just need to do a chdir($pathname) where $pathname is the directory the archive is in - tar unpacks into your current working directory.