use IO::Compress::Gzip; #... my $localFilePath = 'C:/adi_vsfz/CTIP/transferFiles/20091015_Timetable.txt'; my $content; #Open a file handle to the file. if(open(FILE_TO_TRANSFER, $localFilePath)) { my @transferFileContents = ; foreach(@transferFileContents) { $content .= $_; } close(FILE_TO_TRANSFER); my $newContent; IO::Compress::Gzip::gzip($content, $newContent); print("

\n".$content."

\n"); print($newContent."

".length($newContent)."\n"); if($newContent == undef) { print('$newContent is undef'."
\n"); } } #### Timetable Info 0 $newContent is undef