in reply to unpacking .gz from perl

You can use IO::Uncompress::Gunzip's gunzip() function.