How I'm opening and processing compressed log files: open (FILE, "zcat $filename |") or die && error($file); #### The portion that reads the file starting from the bottom: # Run this portion if user chooses bottom if ($pos =~ /\bbottom\b|\bb\b/){ my $bw = File::ReadBackwards->new( $file ) or die "can't read $file: $!\n" ; while( defined( $log_line = $bw->readline ) ) { print $log_line ; }